%% State Space Model (4th-Order Runge Kutta Method for ODEs)
tspan = [0 0.167]; % time step
iniCon = [0;0]; % Initial value of state
[t,y] = ode45(@myode, tspan, iniCon);
plot(t,y(:,1), t,y(:,2));
function dx = myode(t,x)
R = [0.042 0;0 (0.117+40.922)];
L = [0.0276 0.0629; 0.0629 (0.14467+0.0814)];
Vp = 120*sqrt(2);
A = -inv(L)*R;
B = inv(L);
K = [Vp;0];
u = K*sin(377*t+pi/2);
dx = A*x+ B*u;
end

