Help solving a second order differential equation
17 views (last 30 days)
Show older comments
clear;clc
syms y(t)
fun = 0.001*diff(y,t,2)+(1050)*diff(y,t)+(1/0.0047)*y == 0;
cond1 = y(0) == 0;
cond2 = diff(y) == 0;
conds = [cond1 cond2];
ySol(t) = dsolve(fun,conds);
%ySol(t) = dsolve(fun);
ySol = simplify(ySol);
disp(ySol(t))
When I run the code I get the following error: "Unable to reduce to square system because the number of equations differs from the number of indeterminates."
Thank you.
0 Comments
Answers (1)
Star Strider
on 6 Dec 2018
If you use the numeric initial conditions, you get the trivial solution only, that being 0.
If you want to see the full expression (you can substitute in for the initial conditions later), this woirks:
syms y(t) y0 Dy0
Dy = diff(y,t);
D2y = diff(y,t,2);
fun = 0.001*D2y == -((1050)*Dy+(1/0.0047)*y);
cond1 = y(0) == y0;
cond2 = Dy(0) == Dy0;
conds = [cond1 cond2];
ySol(t) = dsolve(fun,conds);
%ySol(t) = dsolve(fun);
ySol = simplify(ySol, 'Steps',20)
disp(ySol(t))
producing:
(608855155^(1/2)*exp(t*((1000*608855155^(1/2))/47 - 525000))*(47*Dy0 + 24675000*y0 + 1000*608855155^(1/2)*y0))/1217710310000 - exp(-t*((1000*608855155^(1/2))/47 + 525000))*((608855155^(1/2)*Dy0)/25908730000 - y0/2 + (105*608855155^(1/2)*y0)/5181746)
2 Comments
Star Strider
on 6 Dec 2018
My pleasure.
Use the subs function:
ySol = subs(ySol, {y0, Dy0}, {0, 0})
The result is still 0 if you do that.
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!