In fact, I am trying to gather the data in a matrix. But I keep receiving the error "Difference order N must be a positive integer scalar" when I use the "for" loop. Otherwise, it works for every m value. Here's the code I am working on below:
syms y(t) Y t %parameters
ed=0.001;Ev=1000;n=4000; A=zeros(41,10);ed=0.001;for m=1:10 eq = diff(y,t) == (1/m)*(((Ev*(ed*t-y))/n)^m); [VF,Subs] = odeToVectorField(eq); DE = matlabFunction(VF, 'Vars',{t,Y}); [t,y] = ode45(DE, [0 10], 0); A(:,m)=y;end
Best Answer