Fracture fatigue problem, summation inside loops

2 visualizaciones (últimos 30 días)
Christopher
Christopher el 15 de Abr. de 2013
Hello,
I am having a hard time trying to figure out how to setup a loop for this fatigue problem. Essentially, I am trying to solve the dK equation in iterations while adding the sum of da to ao. So, iteration one would be solving dK with ao=.125. Iteration 2 would be solving dK with ao=.125+sum(da) from the previous iteration. I am trying to run this process until dK reaches a value of 70. I think I am close, but I just can't get the loop to workout correctly.
dsigma=[46 26 16 12 24 26 16]';
R=[0 0.44 0.6 0.67 0.43 0.41 0.64]';
N=[1 2 3 17 3 1 2]';
ao=.125;
dK=dsigma.*sqrt(pi*ao)*((0.5*(3-(ao./(.125+ao)))*(1+1.243*(1-(ao./(.125+ao)))^3)))
da=(((3*10^-6).*(dK).^2.2)./((1-R)*70-dK)).*N
deltaa=sum(da);
while dK<70
a1=ao+sum(da1);
dK1=dsigma.*sqrt(pi*a1)*((0.5*(3-(a1./(.125+a1)))*(1+1.243*(1-(a1./(.125+a1)))^3)));
da1=(((3*10^-6).*(dK1).^2.2)./((1-R)*70-dK1)).*N;
end

Respuesta aceptada

Cedric
Cedric el 16 de Abr. de 2013
Editada: Cedric el 16 de Abr. de 2013
You are setting a condition on dK in your WHILE statement, but you compute dK1 in the loop. Both should match (either use dK or dK1, but not both). If you wanted to save the "trajectory" of dK, you could define it as a 1D array and use a loop index to increment the index in dK at each iteration, e.g.
...
k = 1
dK(k) = dsigma.*sqrt(pi*ao)*((0.5*( .. etc
...
while dK(k) < 70
k = k + 1 ;
...
dK(k) = dsigma.*sqrt(pi*a1)*((0.5*(3- .. etc
...
end
This would not be optimal as dK should be preallocated, but let's not focus on that for now.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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