please help me with this problem,
i want to solve ODEs many times with different value of "v2" variable,
so i use if statement to loop it, but the output of X2 look wrong especially its size (41×4)
i try 1 time solving with one value of "v2" only, it turns out size of X2 is about 6000×4
here's the code
x_extend = zeros(121,1);x_compress = zeros(121,1);v2=0; for i=0:1:120 v2=v2+i; save input.mat t_end = 2.5; TSPAN = [0 t_end]; %Solving duration
IC = [0; 0; 0; 0]; %Initial conditions
[T2, X2]= ode45(@PTVP2, TSPAN, IC,options); a=X2(:,3)-X2(:,1); x_extend(i+1) = max(a); x_compress(i+1) = min(a); end
Best Answer