Help solving a second order differential equation

16 次查看(过去 30 天)
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.

回答(1 个)

Star Strider
Star Strider 2018-12-6
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 个评论
Reymi Chacon
Reymi Chacon 2018-12-6
How do I define the initial conditions after the equation has been solved? I tried
y0=0;
dy0=0;
But it doesnt work. Thanks fot the reply btw
Star Strider
Star Strider 2018-12-6
My pleasure.
Use the subs function:
ySol = subs(ySol, {y0, Dy0}, {0, 0})
The result is still 0 if you do that.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by