several initial conditions in a loop
Show older comments
a=0.2;b=0.2;c=5.7;sigma= 16; beta= 4; rho = 45.92;
% initial condition
x= rand(9,1);
g= (0:5:60);
% g= 0.5;
% computing the trajectory
dt = 0.01;
tspan = 100000;
xinput = x;
X = zeros(9,tspan);
deltaDR=zeros(length(g));
deltaRA=zeros(length(g));
for j= 1:length(g)
X(:,1)=x;
for i = 1: tspan
xoutput = rk4angelstepb(@attractor,dt,xinput,a,b,c,sigma,beta,rho,g(j));
X(:,i) = xoutput;
xinput = xoutput;
end
have a silmulation problem with a nonlinear dynamical equations. I have written my matlab code given above. Now, I want to run the code for several times say up to 100 times different initial values using a loop and finally taking the average of these initial values. How can I do it please?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!