First off, My code is 600+ lines long so I cannot post the entire script. Here is my setup for nested while loops:
count = 0;
CL=.45;
CL_IC1 = 0;
R_calc = 0;
while R_calc-20 <= R_all
Fuel_Rat = Fuel_Rat+.001;
count = count +1;
syms x
syms y
while abs(CL-CL_IC1)>= .001
CL = CL+.001;
Basically, I need the R_calc and R_all to converge for a given CL that also converges with its output. I was checking the initial calculations by hand and found some errors. The final value for the Fuel_Rat term is .4048; however in the computations shown below, it uses its initial value, which is .3578.
WS_TO = WS_LD./(1-XX*Fuel_Rat);
When I use the initial value for "Fuel_Rat" the output is identical to the work space value. Does anyone know why this is occurring? XX = .75

댓글 수: 4

Alec Carruthers
Alec Carruthers 2018년 4월 18일
To narrow my question, it seems like within the CL while loop "Fuel_Rat" is its initial value. But once this loop ends, it begins to iterate. How do I fix this problem, such that the "CL loop uses the final value for "Fuel_Rat"?
Walter Roberson
Walter Roberson 2018년 4월 18일
You haven't posted enough of your code for us to give an opinion.
Shounak Shastri
Shounak Shastri 2018년 4월 19일
As Walter said, the code you posted is not enough.
You can check if the code updates the values of R_calc and Fuel_Rat at the end of each loop.
Stephen23
Stephen23 2018년 4월 19일
"My code is 600+ lines long so I cannot post the entire script"
Yes you can: click the paperclip button to upload the code as a file.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2018년 4월 18일

댓글:

2018년 4월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by