필터 지우기
필터 지우기

while loop isn't working? what's my mistake??HELP

조회 수: 1 (최근 30일)
B
B 2015년 3월 28일
편집: B 2015년 3월 29일
I'm new in MATLAB.. I tried to run the following code, but the loop isn't working :( would you plz explain for me what's happening???
--------------------------------------------------------------------------
Mb=390;
Tb=110;
TCini=107.26;
Tv=80
TV=110;
Mpwini=3;
tolMpw=2;
s0=0.45;
Cp_cavg=4.18;
Tc=103.25;
x=0;
tc=TCini-4;
i=0
while tolMpw > 1
A = 8.325e-2 + 1.883e-4*TV + 4.02e-6 *TV^2
B = - 7.625e-4 + 9.02e-5*TV- 5.2e-7*TV^2
C = 1.522e-4 - 3e-6*TV - 3e-8*TV^2
delTv=TV-Tv
NEA =((33*delTv)^0.33)/TV
hf= 2501.897149 - 2.407064037* TV + 1.192217e-3*TV^2-1.5863e-5*TV^3
s=s0+0.001
BPE = A*s + B*s^2 + C*s^3
Tv=Tb-NEA-BPE
Mb=Mb-Mpwini
Q= Mb*Cp_cavg*(TCini-Tc)
Mpw=Q/hf
tolMpw=(Mpw-Mpwini)
display(i)
Mpwini=Mpw;
s0=s;
i= i+1
end
------------------------------------------------------------------------------
thanks a lot!!!!
  댓글 수: 2
Image Analyst
Image Analyst 2015년 3월 28일
The code runs without generating an error. Please explain what "isn't working" means to you.
B
B 2015년 3월 28일
편집: B 2015년 3월 29일
Thank you very much :) It's actually working..Sorry for wasting your time (I wasted around 4 hrs, and then after reading your comment, I've added "tolMpw=abs(Mpw-Mpwini)" which is giving the correct results..

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by