loops for different variables

2 ビュー (過去 30 日間)
harley
harley 2014 年 8 月 5 日
コメント済み: harley 2014 年 8 月 5 日
hello i have part of a script below that i have stripped back, (there is also a function file that i have not included & a bunch of other global values). How do a run this so that it runs for differing values of Kt.
thanks
t0=0;
tf=2;
ICS = [0 -0.1]';
global Kt
%
Kt=1e3; % I want to run this script for Kt=2e3 & Kt=4e3 also
%
[t,Theta]=ode45('As1_fn1',[t0,tf],ICS);

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 8 月 5 日
p=[1e3 2e3 4e3]
for k=1:numel(p)
Kt=p(k);
[t{k},Theta{k}]=ode45('As1_fn1',[t0,tf],ICS);
end
  1 件のコメント
harley
harley 2014 年 8 月 5 日
thanks Azzi

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by