MATLAB Answers

log base 10 plot

25 views (last 30 days)
Jocelyn
Jocelyn on 3 Mar 2021
Answered: Rik on 3 Mar 2021
Good day,
I am trying to figure out why there is no line plotted on my graph once this script is run. I tried playing around with the axis thinking that maybe that was why I wasn't seeing anything plotted; however, this did not resolve my issue.
Is there an error in this code/axis that is preventing it from showing a plot on the graph?
Thank you for your assistance!
Co = 2.666;
C1 = - 2.769;
C2 = - 0.06247;
C3 = 2.676;
C4 = 0.06411;
C5 = - 4.994;
C6 = 0.181;
C7 = 5.374;
C8 = - 0.4159;
C9 = - 2.715;
C10 = - 0.05814;
C11 = 0.6429;
C12 = 0.208;
C13 = - 0.1394;
Ps_ko = - 0.1239;
Ps_k1 = 0.8705;
for Z = 0.0553: 0.01: 40
U_Ps = Ps_ko + Ps_k1*(log10(Z));
Y_Ps = Co + C1*U_Ps + C2*U_Ps^2 + C3*U_Ps^3 + C4*U_Ps^4 + C5*U_Ps^5 + C6*U_Ps^6 + C7*U_Ps^7 + C8*U_Ps^8 + C9*U_Ps^9 + C10*U_Ps^10 ...
+ C11*U_Ps^11 + C12*U_Ps^12 + C13*U_Ps^13;
end
loglog(Z, Y_Ps)
axis( [0.01 100 0.01 1])
% loglog(Z, Y_Ps)
% axis( [0.01 100 0.001 100000])
% grid on

Accepted Answer

Rik
Rik on 3 Mar 2021
You're plotting a single value, but you left the default for plot, which is to only show lines, not markers. So your plot looks like it has no effect.
Co = 2.666;
C1 = - 2.769;
C2 = - 0.06247;
C3 = 2.676;
C4 = 0.06411;
C5 = - 4.994;
C6 = 0.181;
C7 = 5.374;
C8 = - 0.4159;
C9 = - 2.715;
C10 = - 0.05814;
C11 = 0.6429;
C12 = 0.208;
C13 = - 0.1394;
Ps_ko = - 0.1239;
Ps_k1 = 0.8705;
Z = 0.0553: 0.01: 40;
U_Ps = Ps_ko + Ps_k1*(log10(Z));
Y_Ps = Co + C1*U_Ps + ...
C2*U_Ps.^2 + C3*U_Ps.^3 + C4*U_Ps.^4 + ...
C5*U_Ps.^5 + C6*U_Ps.^6 + C7*U_Ps.^7 + ...
C8*U_Ps.^8 + C9*U_Ps.^9 + C10*U_Ps.^10 + ...
C11*U_Ps.^11 + C12*U_Ps.^12 + C13*U_Ps.^13;
loglog(Z, Y_Ps)
axis( [0.01 100 0.001 100000])
grid on
You should consider putting all those C values in an array, so you can more easily add or remove values.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by