How can I repeat this simulation 1000 times

1 次查看(过去 30 天)
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 个评论
Temi O
Temi O 2019-2-4
Thank you very much. This has helped a lot!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by