loglog plot command not working,gives linear plot. I need help to make it work
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Frederick Anokye
el 4 de Mayo de 2020
Respondida: dpb
el 4 de Mayo de 2020
% plot of radius of critical nucleus against temperature
Lf = 10.9375e8;
Gma = 0.176;
Teq = 1235;
nstep = 125;
del_T=1100;
storage = zeros(nstep,2);
for i=1:nstep
r = -(2*Gma*Teq)/(Lf*-del_T);
storage(i,:) = [del_T, r];
del_T = del_T + 1;
end
history = zeros(nstep,2);
q = storage(:,2);
del_T=1100;
for j = 1:nstep
Del_G = (4*pi*((q(j)^2)*Gma) + ((4/3)*pi*(q(j))^3)*((Lf*-del_T)/Teq));
history(j,:) = [del_T, Del_G];
del_T = del_T + 1;
end
figure(1); clf;
loglog((storage(:,1)),(storage(:,2)),'r-', 'linewidth',2)
xlabel('Temperature (K)');
ylabel('Critical Radius (m)');
title('Plot of Critical Radius vs. Temperature Q2a');
string = ' r* = -2*Gma*Teq/Lf*-del_T;';
text (200, 2.2e-10,string)
figure(2); clf;
loglog((history(:,1)),(history(:,2)),'r-', 'linewidth',2)
xlabel('Temperature (K)');
ylabel('Activation Free Energy (J)');
title('Plot of Activation Free Energy vs. Temperature Q2b');
string = ' Del G = 4*pi*((q(j)^2)*Gma + (4/3)*pi*(q(j))^3)*((Lf*-del_T)/Teq)';
text (-1500, 2.7e-10,string);
x = history(:,1);
y = history(:,2);
figure(3 ); clf;
loglog(x, (y*0.15625),'r-', 'linewidth',2)
xlabel('Temperature (K)');
ylabel('Heterogenous Nucleation');
title('Plot of Heterogenous Nucleation vs. Temperature Q2c');
grid on
0 comentarios
Respuesta aceptada
dpb
el 4 de Mayo de 2020
The plots are correct; you simply do not have enough dynamic range of the variables from minimum to maximum values that the logarithmic nature of the axes is easily apparent.
The log axis could be observed by setting for Figure 1
ylim([1E-10 1E-9])
Of course, the data then will look essentially like a line with a very shallow negative slope at about 3.4E-10, but you'll be able to see the axis tick marks are logarithmically distributed.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!