Solving a 2nd order ODE for specific parameters
4 views (last 30 days)
Show older comments
Job on 4 Jun 2011
Answered: John D'Errico on 7 Feb 2023
So i've been trying for over an hour now to solve this equation in matlab -> m(d^2x/dt^2) = −kx − β(dx/dt), and I'm new to the software so I am unable to do it, I tried it with ODE45 with no success. The goal is to solve this (find value of B) for when λ^2 − ω^2 > 0, with 2λ = β/m, and ω^2 = k/m, any help would be greatly appreciated thank you!!
John D'Errico on 7 Feb 2023
Did you try it? What did you try? For example, I started with what you said. YOU CANNOT use ODE45 to solve a problem where the parametters are not given numerically. However a symbolic solution almost falls out on the floor. It just drops out directly. So my guess is you thought that a numerical solver could solve such a problem. It cannot.
syms B k lambda omega m
ODE = diff(x,2) == -k/m*x - B/m*diff(x)
Next, replace k/m with omega^2.
ODE = subs(ODE,k/m,omega^2)
And B/m is now just 2*lambda.
ODE = subs(ODE,B/m,2*lambda)
You don't tell us anything about initial values. So a numeerical solver would not apply. But dsolve should have no serious problem.
If I look at the solution as found, we see that if (lambda^2 - omega^2) is greater than zero, then look carefully in the radicals. Do you recognize that
lambda^2 - omega^2 = (lambda+omega)*(lambda-omega) > 0
This tells us the solutions to your problem are ALWAYS real valued as long as that inequality applies, because the value inside the radical is always positive.
Anyway, the solution seems straightforward. If you had initial values, etc., or values for those parameters, you could now get the complete solution, as just a sum of the two exponential components.
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!