Solving a Second Order Differential Equation

조회 수: 18 (최근 30일)
Anthony Mullins
Anthony Mullins 2021년 1월 29일
편집: James Tursa 2021년 1월 29일

답변 (2개)

Steven Lord
Steven Lord 2021년 1월 29일
syms x t y(t)
dx = diff(x, t)
dx = 
0
dy = diff(y, t)
dy(t) = 
x is not a function of t so its derivative with respect to t is 0.
y is a function of t so its derivative with respect to t is not 0. [It could be, if you substituted a constant into dy for y, but it's not always zero.]
dyForConstant = subs(dy, y, 5)
dyForConstant(t) = 
0
dyForNonconstant = subs(dy, y, sin(t))
dyForNonconstant(t) = 
  댓글 수: 1
Anthony Mullins
Anthony Mullins 2021년 1월 29일
편집: Anthony Mullins 2021년 1월 29일
@Steven Lord I was getting the same error with the y instead of x. The error said there is no differential equations found. So I switched them not knowing that dx = 0. But I still cannot solve this.
I get this when I remove the % for the cond

댓글을 달려면 로그인하십시오.


James Tursa
James Tursa 2021년 1월 29일
편집: James Tursa 2021년 1월 29일
Here is what I get:
>> syms y(t)
>> eqn = 4*diff(y,t,2)+32*diff(y,t)+24*y^3 == 192;
>> Dy = diff(y,t);
>> cond = [y(0)==1.5, Dy(0)==0];
>> ySol(t) = dsolve(eqn,cond)
Warning: Unable to find symbolic solution.
> In dsolve (line 216)
ySol(t) =
[ empty sym ]
Maybe not surprising that it can't find a symbolic solution given the y^3 term. So you could use a numeric solver instead. E.g.,
f = @(t,y) [y(2);(192 - 32*y(2) - 24*y(1)^3)/4];
[t,y] = ode45(f,[0 10],[1.5;0]);
plot(t,y(:,1)); grid on

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by