plot is going to zero

4 visualizaciones (últimos 30 días)
Matheus
Matheus el 30 de Abr. de 2014
Comentada: Matt J el 17 de Ag. de 2017
I am doing a plot, but I don't know why the curve is going to (0,0).
c = 0.66*10^-8;
m = 2.25;
K_IC= 65;
R=-1;
a_0 = 0.1;
delta_K_TH = 5;
s=[4];
n=[1.7813e+06];
sigma_maximum = 2;
while sigma_maximum<=40
a_f = (1/pi)*(K_IC/(1.1215*sigma_maximum))^2 intensity factor
sigma_minimum =sigma_maximum*R;
delta_sigma=sigma_maximum-sigma_minimum
delta_K = 1.1215*delta_sigma*sqrt(pi*a_0)
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); % necessary number of cycles to make the material fail
single(number_cycles)
n(sigma_maximum)= number_cycles;
s(sigma_maximum)=sigma_maximum;
end
sigma_maximum=sigma_maximum+1
end
plot(n,s)
  1 comentario
bym
bym el 30 de Abr. de 2014
Editada: bym el 30 de Abr. de 2014
please format your code using {}code button
What are you trying to do? It looks like some sort of fracture mechanics, but the code is a hot mess... best I could clean it up is following... but still am lost
c = 0.66*10^-8;
m = 2.25;
K_IC= 65;
R=-1;
a_0 = 0.1;
delta_K_TH = 5;
s=4;
n=1.7813e+06;
sigma_maximum = 2;
while sigma_maximum<=40
a_f = (1/pi)*(K_IC/(1.1215*sigma_maximum))^2; %?intensity factor
sigma_minimum =sigma_maximum*R;
delta_sigma=sigma_maximum-sigma_minimum;
delta_K = 1.1215*delta_sigma*sqrt(pi*a_0);
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); % necessary number of cycles to make the material fail
single(number_cycles) ;
n(sigma_maximum)= number_cycles;
s(sigma_maximum)=sigma_maximum;
end
sigma_maximum=sigma_maximum+1
end
plot(n,s)

Iniciar sesión para comentar.

Respuestas (1)

Roger Stafford
Roger Stafford el 1 de Mayo de 2014
The test you make at:
if(delta_K >= delta_K_TH)
is not satisfied for 'sigma_maximum' equal to 2 and 3. Consequently the 2nd and 3rd positions in the arrays 'n' and 's' are skipped and left at a default value of 0. That would give you a (0,0) value in your plot.
If you don't want that to happen, you should change the lines
n(sigma_maximum) = number_cycles;
s(sigma_maximum) = sigma_maximum;
to
n = [n,number_cycles];
s = [s,sigma_maximum];
This would avoid leaving the two default zero values in 'n' and 's'. However they would then possess only 38 elements each.
  2 comentarios
Matheus
Matheus el 1 de Mayo de 2014
Thank you. definitely, help me
Matt J
Matt J el 17 de Ag. de 2017
If it helped you, you should click Accept on Roger's answer.

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by