MATLAB Answers

How to find the closed form solution of the natural and forced response of 2sin(3t) - 4x with x(0) = 0

조회 수: 1(최근 30일)
Angelica Belo
Angelica Belo 2021년 9월 3일
댓글: Angelica Belo 2021년 9월 3일
So far I have used dsolve and have the following code:
syms x(t)
eqn = diff(x,t) == 2*sin(3*t)-4*x;
S = dsolve(eqn)
with the result as
S =
C1*exp(-4*t) - (2*cos(3*t + atan(4/3)))/5
However seeing the result, I am not very sure if I am doing this correctly. Any help would be greatly appreciated. Thanks!

채택된 답변

John D'Errico
John D'Errico 2021년 9월 3일
편집: John D'Errico 2021년 9월 3일
Why do you think it is not correct? Would dsolve lie? That dsolve code must be pretty darn tricky.
In fact, you have not used dsolve completely properly, because you never supplied the initial condition. You could have done so after the fact though, by solving for C in your solution such that the initial condition applies.
syms x(t)
eqn = diff(x) == 2*sin(3*t) - 4*x;
xsol = dsolve(eqn,x(0) == 0)
xsol = 
Is that the solution? Does it satisfy the initial condition?
subs(xsol,t,0)
ans = 
0
Clearly it satisfies the initial condition.
simplify(subs(eqn,x,xsol))
ans(t) = 
symtrue
It does satisfy the ODE.
  댓글 수: 1
Angelica Belo
Angelica Belo 2021년 9월 3일
You are an amazing teacher. Thank you for taking the time to answer my question in detail :)

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

추가 답변(0개)

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by