Reiterate a function from an initial value

3 ビュー (過去 30 日間)
Alexander Madsen
Alexander Madsen 2022 年 3 月 18 日
コメント済み: Alexander Madsen 2022 年 3 月 18 日
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 件のコメント
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.
Alexander Madsen
Alexander Madsen 2022 年 3 月 18 日
Thanks, it works

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by