figure shows up but it is empty

I am getting a blank plot. I am using the following code:
c = 0.66*10^-8;
m = 2.25;
K_IC= 65;
R=-1;
a_0 = 0.1;
delta_K_TH = 5;
for sigma_maximum =0:20
a_f = (1/pi)*(K_IC/(1.1215*sigma_maximum))^2;
sigma_minimum =sigma_maximum*R;
delta_sigma= sigma_maximum-sigma_minimum;
delta_K=1.1215*delta_sigma*sqrt(pi*a_f);
if(delta_K >= delta_K_TH)
syms a;
number_cycles = int((c.*(1.1215.*delta_sigma.*sqrt(pi*a)).^ m).^-1,a_0,a_f);
plot(number_cycles,sigma_maximum)
end
end
I would like to have a plot of sigma_maximum as a function of number_cycles

Respuestas (1)

Image Analyst
Image Analyst el 29 de Abr. de 2014

0 votos

You're just plotting a single point over and over again. And since hold is not "on", you're blowing away the previous points you plotted. Just index the variables inside the loop (in other words, make them arrays), and do the plot after the loop .

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Abr. de 2014

Respondida:

el 29 de Abr. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by