plot is going to zero

조회 수: 5 (최근 30일)
Matheus
Matheus 2014년 4월 30일
댓글: Matt J 2017년 8월 17일
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
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
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
Matheus
Matheus 2014년 5월 1일
Thank you. definitely, help me
Matt J
Matt J 2017년 8월 17일
If it helped you, you should click Accept on Roger's answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by