plot is going to zero

4 Ansichten (letzte 30 Tage)
Matheus
Matheus am 30 Apr. 2014
Kommentiert: Matt J am 17 Aug. 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 Kommentar
bym
bym am 30 Apr. 2014
Bearbeitet: bym am 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)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Roger Stafford
Roger Stafford am 1 Mai 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 Kommentare
Matheus
Matheus am 1 Mai 2014
Thank you. definitely, help me
Matt J
Matt J am 17 Aug. 2017
If it helped you, you should click Accept on Roger's answer.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by