plot is going to zero
3 views (last 30 days)
Show older comments
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 Comment
bym
on 30 Apr 2014
Edited: bym
on 30 Apr 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)
Answers (1)
Roger Stafford
on 1 May 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 Comments
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!