% 2 Degree of Freedom (Analytical)
% 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

eqns = [m*D2x+(kf+kr)*x(t)+(kf*(p-b)-kr*b)*phi(t)==0, I*D2phi+(kf*(p-b)-kr*b)*x(t)+(kf*(p-b)^2+kr*b^2)*phi(t)];

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

figure
ezplot (phiSol)
figure
ezplot (xSol)