Vote count:
0
So far, I tried this. I converted to first order ODE
Q''(t) = 10cos(wt)-5Q(t)-4Q'(t)
x1=Q(t)
x2=Q'(t)
x1'=Q'(t)=x2
&, x2'=Q"(t)=10cos(wt)-5Q(t)-4Q'(t)
or, simply
x1' = x2
x2'=10cos(wt)-5Q(t)-4Q'(t)
then the matlab code...
function project2
[t,x] = ode45(@dfile,[0,80],[0;0]);
plot(t,x(:,0))
title("LQ''(t)+RQ'(t)+(1/C)Q(t)=E(t), Q(0)=0, Q'(0)=0")
xlabel('t', ylabel('y'), grid
function xprime = dfile(t,x)
xprime = zeros (2,1);
xprime(1)=x(2);
xprime(2)= 10cos(omega*t)-5x(1)-4x(2);
Now, I have never done matlab in life and apparently we have this project I need to finish, can anybody help me please?
asked 39 secs ago
Matlab Ordinary Differential Equation solver?
Aucun commentaire:
Enregistrer un commentaire