Borrar filtros
Borrar filtros

Logarithmic scale problem in 2D graph

2 visualizaciones (últimos 30 días)
Yordani
Yordani el 27 de Dic. de 2022
Comentada: Star Strider el 28 de Dic. de 2022
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 comentario
Karim
Karim el 27 de Dic. de 2022
Editada: Karim el 27 de Dic. de 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)

Iniciar sesión para comentar.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by