Fracture fatigue problem, summation inside loops
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Cedric
2013년 4월 16일
편집: Cedric
2013년 4월 16일
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.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!