| Author |
Comment/Response |
Mike Antonakakis
|
07/16/09 10:45pm
I'm doing some homework where I am trying to solve for two variables. I have an equation written in matrix form (if my math grammar isn't correct, I apologize). I have a few matrices:
q={{vy[t]},{r[t]} <-- these are the two variable I need to end up plotting vs time
q'={{vy'},{r'}}
A={{a,b},{c,d}}
u={{e},{f}}
where a,b,c,d,e,f are constants.
Now the equation given is q'=A.q+u. This gives me two differential equations:
vy'=a*vy+b*r+e
and
r'=c*vy+d*r+f
I don't have any issue using NDSolve to solve those two equations, I type this:
q = NDSolve [{vy'[t] == a*vy[t] + b*r[t] + e*dt,
r'[t] == c*vy[t] + d*r[t] + f*dt, r[0] == 0, vy[0] == 0}, {vy,
r}, {t, 3}]
and I get what I'm looking for.
So my question is, is there any way to skip the part where I find the two differential equations myself? In other words, is there a way I can input the equation in matrix form and solve for vy[t] and r[t] in one step?
I just started using Mathematica a few days ago, and have never used anything more complicated than a TI-83+ before this, so please excuse my lack of knowledge.
I've attached the file that works for me when I input the two equations myself.
Attachment: ch10-12hopefullyfinal.nb, URL: , |
|