Python to Matlab - While loops

6 ビュー (過去 30 日間)
Nihal Paul
Nihal Paul 2016 年 3 月 7 日
編集済み: Jan 2016 年 3 月 7 日
This is part of the Python code I have that I need to convert Matlab. I just don't understand how while loops work in general. If someone can just get me started I can catch on pretty fast.
while dt*t<=tFinal:
NA.append((-Lamda*NA[t-1]*dt)+NA[t-1])
NB.append(((-LamdaB*NB[t-1]+LamdaA*NA[t-1])*dt)+NB[t-1])
NC.append((Lamda*NB[t-1]*dt)+NC[t-1])
N2T.append(NB0*exp(-LamdaB*Time[t-1]+((LamdaA*NA0)/(LamdaA-LamdaB))*(exp(-LamdaA*dt)-exp(-LambdaB*dt))]
sum.append(NA[t-1]+NB[t-1]+NC[t-1]
t=t+=1

回答 (1 件)

Jan
Jan 2016 年 3 月 7 日
編集済み: Jan 2016 年 3 月 7 日
Did you read this already:
doc while
A while loop runs as long as the condition is true:
t = 0;
while dt*t <= tFinal
...
t = t + 1;
end

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by