tspan=[0 50];
%State Vector = y = [x xdot phi phidot];
y0=[0 0 10*pi/180 0]  %initial conditions
[t,y]=ode45(@secondode,tspan,y0);

x=y(:,1);
xdot=y(:,2);
phi=y(:,3)*180/pi;
phidot=y(:,4)*180/pi;


%plot state vector
close all
figure
subplot(2,2,1)
plot(t,x)
ylabel('x, [m]')
xlabel('t,[s]')
grid
subplot(2,2,2)
plot(t,xdot)
ylabel('xdot, [m/s]')
xlabel('t,[s]')
grid
subplot(2,2,3)
plot(t,phi)
ylabel('phi, [deg]')
xlabel('t,[s]')
grid
subplot(2,2,4)
plot(t,phidot)
ylabel('phidot, [deg/s]')
xlabel('t,[s]')
grid