plot is going to zero
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
bym
2014-4-30
编辑:bym
2014-4-30
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)
回答(1 个)
Roger Stafford
2014-5-1
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!