Hey guys, I'm trying to make my code below to give me N=1:10 (repeating the for loop 10 times) in addition to 1:20 and 1:50, do I need to make separate for loops for this or is there some way to get the current loop to give me this information?
clear;x0=[42;0;95];extinct=0;W=zeros(1,200);for N=[1:10] F=2*rand(1) for t=1:200; W(t)=F; A=[0 0 F; .6 0 0; 0 .75 .55]; x=(A^t)*x0; if (sum(x)<1); extinct=extinct+1; break; end endendfprintf('Number of extinction events:%d\n',extinct)
Best Answer