Logarithmic scale problem in 2D graph

1 次查看(过去 30 天)
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 个评论
Karim
Karim 2022-12-27
编辑:Karim 2022-12-27
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)

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2022-12-27
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 个评论
Yordani
Yordani 2022-12-28
I already found the mistake! Thanks for your contribution!
Star Strider
Star Strider 2022-12-28
My pleasure!
Just out of curiosity, what was the mistake? We’d all like to know!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by