Help solving a second order differential equation

17 visualizzazioni (ultimi 30 giorni)
clear;clc
syms y(t)
fun = 0.001*diff(y,t,2)+(1050)*diff(y,t)+(1/0.0047)*y == 0;
cond1 = y(0) == 0;
cond2 = diff(y) == 0;
conds = [cond1 cond2];
ySol(t) = dsolve(fun,conds);
%ySol(t) = dsolve(fun);
ySol = simplify(ySol);
disp(ySol(t))
When I run the code I get the following error: "Unable to reduce to square system because the number of equations differs from the number of indeterminates."
Thank you.

Risposte (1)

Star Strider
Star Strider il 6 Dic 2018
If you use the numeric initial conditions, you get the trivial solution only, that being 0.
If you want to see the full expression (you can substitute in for the initial conditions later), this woirks:
syms y(t) y0 Dy0
Dy = diff(y,t);
D2y = diff(y,t,2);
fun = 0.001*D2y == -((1050)*Dy+(1/0.0047)*y);
cond1 = y(0) == y0;
cond2 = Dy(0) == Dy0;
conds = [cond1 cond2];
ySol(t) = dsolve(fun,conds);
%ySol(t) = dsolve(fun);
ySol = simplify(ySol, 'Steps',20)
disp(ySol(t))
producing:
(608855155^(1/2)*exp(t*((1000*608855155^(1/2))/47 - 525000))*(47*Dy0 + 24675000*y0 + 1000*608855155^(1/2)*y0))/1217710310000 - exp(-t*((1000*608855155^(1/2))/47 + 525000))*((608855155^(1/2)*Dy0)/25908730000 - y0/2 + (105*608855155^(1/2)*y0)/5181746)
  2 Commenti
Reymi Chacon
Reymi Chacon il 6 Dic 2018
How do I define the initial conditions after the equation has been solved? I tried
y0=0;
dy0=0;
But it doesnt work. Thanks fot the reply btw
Star Strider
Star Strider il 6 Dic 2018
My pleasure.
Use the subs function:
ySol = subs(ySol, {y0, Dy0}, {0, 0})
The result is still 0 if you do that.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by