How can I repeat this simulation 1000 times

3 ビュー (過去 30 日間)
Temi O
Temi O 2019 年 2 月 4 日
コメント済み: Temi O 2019 年 2 月 4 日
U1= 13.5;
U2= 9;
dt= 0.01; %time step
MAXT= 0.5;%maximum time (s)
a= 1.2; % threshold
x1(1)=0.5*a;
x2(1)=0.5*a;
for i= 1:MAXT/dt;
x1(i+1) = x1(i) + dt*(U1-U2)+ sqrt(dt)*randn- sqrt(dt)*randn;
end

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 2 月 4 日
編集済み: KALYAN ACHARJYA 2019 年 2 月 4 日
U1= 13.5;
U2= 9;
dt= 0.01; %time step
MAXT= 0.5;%maximum time (s)
a= 1.2; % threshold
x1(1)=0.5*a;
x2(1)=0.5*a;
inerations_nos=1;
while inerations_nos<1001
for i= 1:MAXT/dt;
x1(i+1) = x1(i) + dt*(U1-U2)+ sqrt(dt)*randn- sqrt(dt)*randn;
end
inerations_nos=inerations_nos+1;
end
or
for j=1:1000
%code
end
  8 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 2 月 4 日
+1 @Luna Thumbs Up
Temi O
Temi O 2019 年 2 月 4 日
Thank you very much. This has helped a lot!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by