Logarithmic scale problem in 2D graph

1 view (last 30 days)
Hello! I am trying to program equation (2) and make graph number 1, specifically the curve that Masetti [21] says, but when I do it I have an error where the graph starts, could someone please help me :(
Graph 1
Mine :(
My code:
u1=68.5;
umax=1414;
u2=56.1;
Cr=9.2e16;
Cs=3.41e20;
alfa=0.711;
beta=1.98;
N1=1e16;
N2=1e16;
N3=1e21;
index=0;
k = N1:N2:N3;
for Ne = 1:length(k)
index = index + 1 ;
u(index) = u1 + ((umax-u1)/(1+(k(Ne)/Cr)^alfa)) - ((u2)/(1+(Cs/k(Ne))^beta));
f(index) = k(Ne);
x(index) = f(index) ;
y(index) = u(index);
end
semilogx(x,y)
yticklabels({'0','100','200','300','400','500'})
  1 Comment
Karim
Karim on 27 Dec 2022
Edited: Karim on 27 Dec 2022
When I try it (see below) I obtain the same curve as you have. The values and the equation are the same as from the snapshot of the paper. Hence, I would say that your curve, also at the start, is indeed correct.
If you want to obtain the same curve as 'graph1' you will need another set of parameters. Are you certain that those parameters corespond to that graph?
EDIT: disabled the ytick label text, as this could lead to wrong interpretation of the data
mu1 = 68.5;
mumax = 1414;
mu2 = 56.1;
Cr = 9.2e16;
Cs = 3.41e20;
alfa = 0.711;
beta = 1.98;
Ne = logspace(16,21,1000);
mu = mu1 + ( (mumax-mu1) ./ (1+(Ne./Cr).^alfa) ) - ( mu2 ./ (1+(Cs./Ne).^beta) );
figure
semilogx(Ne,mu)
%yticklabels({'0','100','200','300','400','500'})
grid on
xlabel('$N_{e}$','interpreter','latex','FontSize',20)
ylabel('$\mu$','interpreter','latex','FontSize',20)

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 27 Dec 2022
I don’t see anything wrong with the code (however I rewrote the μ assignment to make it a bit easier for me to understand in the context of the equation provided).
I suspect there’s something wrong with the y-axis scaling (as expressed in the yticklabels call), however not knowing what that scaling multiplication is, I can’t determine if there’s a problem.
Plotting it without the scaling —
u1=68.5;
umax=1414;
u2=56.1;
Cr=9.2e16;
Cs=3.41e20;
alfa=0.711;
beta=1.98;
N1=1e16;
N2=1e16;
N3=1e21;
Ne = N1:N2:N3;
for k = 1:length(Ne)
u(k) = u1 + ((umax-u1)/(1+(Ne(k)/Cr)^alfa)) - (u2/(1+(Cs/Ne(k))^beta));
end
semilogx(Ne,u)
xlabel('Ne')
ylabel('\mu')
% yticklabels({'0','100','200','300','400','500'})
.
  3 Comments
Yordani
Yordani on 28 Dec 2022
I already found the mistake! Thanks for your contribution!
Star Strider
Star Strider on 28 Dec 2022
My pleasure!
Just out of curiosity, what was the mistake? We’d all like to know!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!