78 views (last 30 days)

A second order mass, damper, spring system can be solved from

syms h(t) m c k h0 dh0 C10 C11

Dh=diff(h(t),t);

eqs = m*diff(h(t), t, t) == -c*Dh-k*h(t);

sol=dsolve(eqs);

h0=subs(sol,t,0);

dh0=subs(diff(sol,t),t,0);

How to rewrite the solution (sol) using the initial condtions (h0, dh0)? I am trying to determine the transition matrix, given h, dh at time 0, find the transition matrix, X, to give h, dh at later time t. I'm looking for a solution like

ic=solve({h0,dh0},{C10, C11})

Star Strider
on 14 Sep 2015

I’m not certain what you’re asking. It’s easy enough to incorporate the initial conditions in your dsolve call, and it’s in the documentation:

syms h(t) m c k h0 dh0 C10 C11

Dh(t)=diff(h(t),t);

eqs = m*diff(h(t), t, t) == -c*Dh-k*h(t);

sol=dsolve(eqs, h(0)==h0, Dh(0)==dh0);

You can also do the integration numerically with ode45, and probably more easily, especially if you use the odeToVectorField function to create the system of first-order ODEs the numeric ODE solvers require. If you do a numeric integration, do not include the initial conditions in your differential equations. Specify them in the ode45 call instead.

Star Strider
on 14 Sep 2015

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 1 Comment

## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/242926-solve-for-symbolic-initial-conditions#comment_309770

⋮## Direct link to this comment

https://ch.mathworks.com/matlabcentral/answers/242926-solve-for-symbolic-initial-conditions#comment_309770

Sign in to comment.