Question: solving linear ODE systems--I wanted to use functions, not expressions...

I have solved ODE's with either i.c. or b.c. (mechanics stuff) where the results were in terms of expressions, not functions.  I could plot these expressions, substitute values in for parameters, etc. 

Then I thought that the real way to solve an ODE or system of ODE's was to define functions.  I wanted this to be in three levels: the solutions in generality, the solutions with i.c./m.c. applied, and then further with the parameter values defined. 

So far, no joy.  Lots of confusion--input eqns as sequence, list, set?  I looked on the Maple help page, thought I was doing things right. I even tried out "union" for the ode's and the ic's.

The code is below; statement (11) produces an error. Yes, I am using Maple 18, even though the file says Maple 15.  I'd like to solve the 4-ODE system at the three levels listed above, and then (if possible), plot the result! Am I asking too much?  Should I be using MapleSim or some other product instead?

 

Thanks for any and all help!

 

robert w.


NULL

restart

assume(m1 > 0);

eqn1 := diff(z1(t), t) = z2(t);

diff(z1(t), t) = z2(t)

(1)

eqn2 := diff(z2(t), t) = -(k1+k2)*z1(t)/m1-(c1+c2)*z2(t)/m1+k2*z3(t)/m1+c2*z4(t)/m1;

diff(z2(t), t) = -(k1+k2)*z1(t)/m1-(c1+c2)*z2(t)/m1+k2*z3(t)/m1+c2*z4(t)/m1

(2)

eqn3 := diff(z3(t), t) = z4(t);

diff(z3(t), t) = z4(t)

(3)

eqn4 := diff(z4(t), t) = k2*z1(t)/m2+c2*z2(t)/m2-k2*z3(t)/m2-c2*z4(t)/m2;

diff(z4(t), t) = k2*z1(t)/m2+c2*z2(t)/m2-k2*z3(t)/m2-c2*z4(t)/m2

(4)

eqns := eqn1, eqn2, eqn3, eqn4;

diff(z1(t), t) = z2(t), diff(z2(t), t) = -(k1+k2)*z1(t)/m1-(c1+c2)*z2(t)/m1+k2*z3(t)/m1+c2*z4(t)/m1, diff(z3(t), t) = z4(t), diff(z4(t), t) = k2*z1(t)/m2+c2*z2(t)/m2-k2*z3(t)/m2-c2*z4(t)/m2

(5)

var := z1(t), z2(t), z3(t), z4(t);

z1(t), z2(t), z3(t), z4(t)

(6)

ic1 := z1(0) = -2;

z1(0) = -2

(7)

ic2 := z2(0) = 0;

z2(0) = 0

(8)

ic3 := z3(0) = 1;

z3(0) = 1

(9)

ic4 := z4(0) = 0;

z4(0) = 0

(10)

ics := ic1, ic2, ic3, ic4;

z1(0) = -2, z2(0) = 0, z3(0) = 1, z4(0) = 0

(11)

dsolve(`union`(eqns, ics), var)

Error, invalid input: `union` received diff(z1(t), t) = z2(t), which is not valid for its 1st argument

 

var;

z1(t), z2(t), z3(t), z4(t)

(12)

data:=(m1=1,m2=2,m3=1,c1=0,c2=0,c3=0,k1=5,k2=2,k3=2);

m1 = 1, m2 = 2, m3 = 1, c1 = 0, c2 = 0, c3 = 0, k1 = 5, k2 = 2, k3 = 2

(13)

eqnsev := subs(data, eqns);

diff(z4(t), t) = z1(t)-z3(t)

(14)

NULL


Download mae340_state_space_4-ode_system.mw

Please Wait...