필터 지우기
필터 지우기

Please, I would appreciate any assistance on debugging the attached code.

조회 수: 3 (최근 30일)
Isaac
Isaac 2016년 4월 1일
편집: Walter Roberson 2016년 4월 2일
The first section of the code is okay, but I am having it difficult solving for uu and ud in the attached code. I want to continue solving for the values of uu and ud as long the conditions in the while loops are valid. Pls, see the attached file.
This is the pseudo code:
for j=1:N
k=1;
uu(k,j)=0;
Lou(k,j)=2;
p(k,j)=6000;
pQ(k,j)=asin(1+Lou(k,j));
Lh2(j)=200;
k22(k,j)=Lh2(j)./Lou(k,j);
if p(k,j)>pQ(k,j)
while Lou(k,j)<Lh2
k22f(k,j)=Lh2(j)./(Lou(k,j)+uus);
funLu(k,j)=asin(1+k22f(k,j));
testfunLu=@(x)eval(subs(funLu(k,j),uus,x))-p(k,j);
uuf(k,j)=fsolve(testfunLu,55);
uu(k+1,j)=uuf(k,j);
Lou(k+1,j)=Lou(k,j)+uu(k+1,j);
k22(k+1,j)=Lh2(j)./(Lou(k+1,j)+uu(k+1,j));
p(k+1,j)=p(k,j);
k=k+1
end
end
end
  댓글 수: 9
Isaac
Isaac 2016년 4월 1일
편집: per isakson 2016년 4월 2일
I have tried using the fsolve this way also
testfunLu=@(x)eval(subs(funLu(k,j),uus,x))-p(k,j);
uuf(k,j)=fsolve(testfunLu,55);
Isaac
Isaac 2016년 4월 1일
편집: per isakson 2016년 4월 2일
This is the pseudo code:
for j=1:N
k=1;
uu(k,j)=0;
Lou(k,j)=2;
p(k,j)=6000;
pQ(k,j)=asin(1+Lou(k,j));
Lh2(j)=200;
k22(k,j)=Lh2(j)./Lou(k,j)
if p(k,j)>pQ(k,j)
while Lou(k,j)<Lh2
k22f(k,j)=Lh2(j)./(Lou(k,j)+uus);
funLu(k,j)=asin(1+k22f(k,j));
testfunLu=@(x)eval(subs(funLu(k,j),uus,x))-p(k,j);
uuf(k,j)=fsolve(testfunLu,55);
uu(k+1,j)=uuf(k,j);
Lou(k+1,j)=Lou(k,j)+uu(k+1,j);
k22(k+1,j)=Lh2(j)./(Lou(k+1,j)+uu(k+1,j));
p(k+1,j)=p(k,j);
k=k+1
end
end
end

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by