Hello , I am trying to solve an ode in matlab
but i'm getting syntax errors. pls help!!
my actual ODE is : m*d2xdt2 + a*(dxdt)^2 + k*x= Fcos(omega*t)
and i need a solution for x which is displacement for an object.
i am trying this way please correct me where i'm wrong
tspan=[0:1800];x0=0;[t,x]=ode45(@(t,x)EQ(tspan,x0,a,k,m,F,omega);plot(t,x);function sol= EQ(t,x) a=1; k=20; m=0.5; F=0.01; omega=2*pi; x=[(F/k)*cos(omega*t)- (m/k)*d2xdt2- (a/k)*(dxdt)^2] sol=x ; end
Best Answer