How to find general solution of second order differential equation

1 view (last 30 days)
This is the first time I am using Matlab to solve differential equations and I have a question. I have the following second order differential equation:
y’’ + 0.2*y’ + 20000000*y = sin(2*pi*t)
How do I find the general solution of this equation?

Answers (2)

KSSV
KSSV on 21 Jun 2020
syms y(t)
ode=diff(diff(y(t),t))+0.2*diff(y(t),t)==sin(2*pi*t) ;
sol = dsolve(ode)
  2 Comments
sun45
sun45 on 21 Jun 2020
Thank you for your response. The code you provided does not contain the 20000000y term. I added it back in and changed some of the numerical constants, such as changing the 0.2 to 0.3. When I reran the code, my answer did not contain any C1, C2, etc. constants. I thought that the general solution of a differential equation should have these constants. For the same equation, I compared MATLAB’s solution to Wolfram Alpha’s and Wolfram contains constants C1, C2, etc. while MATLAB does not contain these constants. How come even if I change the original equation, the general solution with these C1, C2 constants is not provided?
KSSV
KSSV on 22 Jun 2020
I forgot to add that term.....it is not possible to get a solution without constants C1, C2......you recheck..

Sign in to comment.


madhan ravi
madhan ravi on 21 Jun 2020
syms y(t)
ode = diff(y,2) + 0.3*diff(y) +...
2e7*y == sin(2*pi*t);
dsolve(ode)
  13 Comments
sun45
sun45 on 22 Jun 2020
The general solution on Wolfram Alpha contains terms such as C1, C2, etc., the number e raised to a powers, and the imaginary number i. The rewrite command produced an answer that has the number i, but no e or constants. The vpa command produced an answer with C1, C2, and the number e, but no i's. Why is the answer being produced differently, and how can I get the answer to have all three of these things (constants, e’s, and i’s)?
madhan ravi
madhan ravi on 22 Jun 2020
Edited: madhan ravi on 22 Jun 2020
Well, first your question was how to find a general question. And in each question you keep adding an additional question in each question. Make some effort!! Experiment with rewrite(...) . You need to take differential equations class asap! Watch Cleve Moler’s videos!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!