Hi. I am new in Matlab and I am trying to solve the following differential equation.
function [xdot] = HW5P3(t,x)% x is theta
%Function equations
% x(1)=theta,x(2)=thetadot,x(3)=h,x(4)=lambda
v=12.*sin(2.*pi.*(1./2).*t); %sine source
L=1-(2./pi).*abs(x(1));hdot=-((1./pi).*(sign(x(1))./(L.^2)).*(x(4)).^2)-10.*x(3)-x(1);thetadot=1000.*x(3);lambdadot=v-(100./L).*x(4);xdot=[hdot;thetadot;lambdadot];end[t,x]=ode45('HW5P3',[0 5],[1,0,0]);
Best Answer