Hi, Im trying to reiterate this function. I'm aware of using a for loop but im not sure how to set it up. Thanks in advance

 채택된 답변

Davide Masiello
Davide Masiello 2022년 3월 18일
편집: Davide Masiello 2022년 3월 18일
clear,clc
dThetaS = zeros(1,10000);
dThetaS(2) = 2;
dTheta = 1;
dThetaD = 1;
Ka = 1;
idx = 2;
while abs(dThetaS(idx)-dThetaS(idx-1)) > 0.001
dThetaS(idx+1) = ((dTheta+dThetaD)/(1+Ka*dThetaS(idx)))^0.25;
idx = idx+1;
end
dThetaS = dThetaS(2:end);
dThetaS(dThetaS == 0) = [];
plot(dThetaS)

댓글 수: 3

De = 0.234;
h = 2.6;
lambda1 = 0.2426;
lambda2 = 0.444;
T1 = 0.3088;
T2 = 0.1078;
T3 = 0.0538;
n = 3;
KA = ((pi*De*h)/(1+lambda1+lambda2))*((T1/n)+T2*(1+lambda1)+T3*(1+lambda1+lambda2))
deltaS = 2;
idx =1;
deltaS = 2;
idx =1;
while deltaS(idx+1)-deltaS(idx) > 0.001
deltaS(idx+1) = ((dphi+dphid)/(1 + KA * dphief))^(-1/2);
idx = idx +1;
end
T4 = 1/(pi*De*h*dphief)
"Index exceeds the number of array elements (1)."
Davide Masiello
Davide Masiello 2022년 3월 18일
편집: Davide Masiello 2022년 3월 18일
Found a bug in my previous code, so I edited the answer.
Try to substitute the real values of dTheta, dThetaD and Ka and see if it works for you.
Thanks, it works

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by