Hello, i had a system of coupled ODEs and i think i have solved it, the problem is that the variable Y which gives the output, i dont know how to tell what column is the response to the x(t), y(t), z(t) or their first derivatives. Help would be much appreciated. Here is the code
syms x(t) y(t) z(t) p(t) Y p=sin((0.5+3.5*t)*t);D1y = diff(y,t);D2y = diff(y,t,2);D1x = diff(x,t);D2x = diff(x,t,2);D1z = diff(z,t);D2z = diff(z,t,2);eqns=[D2x+2*x-1*y==p,D2y+(0.5*10*exp(-10*t))*D1y-x+2*y-z==0,D2z-y+2*z==0];yode = odeToVectorField(eqns);Yodefcn = matlabFunction(yode, 'Vars',[t Y]);tspan = (0:0.001:10);Y0 = [0 0,0 0,0 0];[T,Y] = ode45(Yodefcn, tspan, Y0);plot(T, Y)
Best Answer