# How to ensure that dsolve provides a trigonometric solution to a second order differential equation?

9 ビュー (過去 30 日間)
Mohit Kumar 2020 年 7 月 10 日
コメント済み: Mohit Kumar 2020 年 7 月 10 日
Hi,
I'm trying to solve the following linear second order equation with dsolve in the symbolic workflow.
When I solve it I get a solution in the form of exponents with complex arguments. I would like to receive the answer in therms of sines and cosines only.
Funnily, when I break the right hand side and solve it part by part, I get trigonometric solutions.
Any ideas on how to force dsolve to give trigonometric solutions? Or simplify the exponents by using the Euler identites?
Thanks,
Mohit

サインインしてコメントする。

### 採用された回答

Bjorn Gustavsson 2020 年 7 月 10 日
Since you have a linear ODE with a right-hand-side composed of harmonic terms you know that you can solve for the homogenous and particular solutions at each frequency separately, so do just that and add them up?
Or simply take the real part of the complex exponential.
However, you have at least two terms C1*sin(t) and C2*cos(t) that will be resonant. That you have to make sure is properly handled (and meaningful).
HTH
##### 1 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
Mohit Kumar 2020 年 7 月 10 日
Alright, I found out about the children function and that will help separate the terms and solve for them independently. Thanks!

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by