Why is dsolve returning an arbitrary constant?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
David Winthrop
il 25 Nov 2019
Modificato: David Goodmanson
il 25 Nov 2019
I have the following differential equation I want to solve from a simple harmonic motion problem.
When I enter this into MATLAB including two initial conditions, I get an arbitrary constant even though there should not be one. Why?
>> syms y(t) g L c
S = dsolve(diff(diff(y(t))) -L*y - g == 0, y(0) == c,diff(y(0))== 0)
S =
exp(-L^(1/2)*t)*(c - C5 + g/L) - g/L + C5*exp(L^(1/2)*t)
0 Commenti
Risposta accettata
David Goodmanson
il 25 Nov 2019
Modificato: David Goodmanson
il 25 Nov 2019
Hi David,
you need slightly different syntax.
syms y(t) g L c
Dy = diff(y)
S = dsolve(diff(diff(y(t))) -L*y - g == 0, y(0) == c,Dy(0)== 0)
S =
(exp(L^(1/2)*t)*(g + L*c))/(2*L) - g/L + (exp(-L^(1/2)*t)*(g + L*c))/(2*L)
Also, assuming k/m = w0^2 is positive as usual, then for harmonic motion the sign of the k/m term needs to change.
syms y(t) g c w0
Dy = diff(y)
S = dsolve(diff(diff(y(t))) +w0^2*y - g == 0, y(0) == c,Dy(0)== 0)
S =
g/w0^2 - (exp(-t*w0*1i)*(- c*w0^2 + g))/(2*w0^2) - (exp(t*w0*1i)*(- c*w0^2 + g))/(2*w0^2)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!