How can I repeat this simulation 1000 times

조회 수: 2 (최근 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 CenterFile Exchange에서 Get 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