Why is dsolve returning an arbitrary constant?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
David Winthrop
am 25 Nov. 2019
Bearbeitet: David Goodmanson
am 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 Kommentare
Akzeptierte Antwort
David Goodmanson
am 25 Nov. 2019
Bearbeitet: David Goodmanson
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!