% 4 Degree of Freedom (No Damping)
% Dr Owen Williams
% Institute of Science and Art
% University of Wales Trinity Saint David

clear; clc
syms x(t) phi(t)
Dx = diff(x) 
D2x = diff(x,2) 
Dphi = diff(phi) 
D2phi = diff(phi,2)
m=100; kf=18000; kr=12000; I=28; p=1.4; b=0.65


A=[m 0;0 I]
a=[D2x;D2phi]
B=[kf+kr kf*(p-b)-kr*b;kf*(p-b)-kr*b kf*(p-b)^2+kr*b^2]
b=[x;phi]

eqns = [A*a+B*b == 0];

[xSol(t),phiSol(t)] = dsolve(eqns, x(0) == 1, Dx(0) == 0, phi(0) == 0, Dphi(0) == 0)

figure
ezplot (phiSol)
figure
ezplot (xSol)