Help solving a second order differential equation
조회 수: 14 (최근 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.
댓글 수: 0
답변 (1개)
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
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 Center 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!