Help solving a second order differential equation

조회 수: 14 (최근 30일)
Reymi Chacon
Reymi Chacon 2018년 12월 6일
댓글: Star Strider 2018년 12월 6일
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