ODE Inverse Laplace Transformation Constants Error

Hey guys! I'm trying to use matlab to solve an ODE with the following IC's: y(0) = 2, y'(0) = 0 and the function u(t) = 3*exp(-2*t). The ODE is 3*y''+12*y'+9*y = 9*u'+14*u(t). The code I used in matlab is as follows:
clear; clc; close all;
syms u(t) y(t) s
Dy = diff(y);
u(t) = 3*exp(-2*t)
ode1 = 3*diff(diff(y))+12*diff(y)+9*y == 9*diff(u)+14*u
cond1 = y(0) == 2;
cond2 = Dy(0) == 0;
conds = [cond1 cond2]
ySol1 = dsolve(ode1, conds)
The function that is returned is exp(-3*t)*(exp(2*t)+4*exp(t)-3) when it should be returning (11/2)*exp(-t)+4*exp(-2*t)-(15/2)*exp(-3*t). The constants for the partital fraction decomposition seem to be wrong. What could the issue be with my code? I'm using it to double check my handwork for a dyanmic systems modeling class. Thanks in advance for any help!

2 commentaires

Question originally posted by Ri Eld (restored from Google cache):
ODE Inverse Laplace Transformation Constants Error
Hey guys! I'm trying to use matlab to solve an ODE with the following IC's: y(0) = 2, y'(0) = 0 and the function u(t) = 3*exp(-2*t). The ODE is 3*y''+12*y'+9*y = 9*u'+14*u(t). The code I used in matlab is as follows:
clear; clc; close all;
syms u(t) y(t) s
Dy = diff(y);
u(t) = 3*exp(-2*t)
ode1 = 3*diff(diff(y))+12*diff(y)+9*y == 9*diff(u)+14*u
cond1 = y(0) == 2;
cond2 = Dy(0) == 0;
conds = [cond1 cond2]
ySol1 = dsolve(ode1, conds)
The function that is returned is exp(-3*t)*(exp(2*t)+4*exp(t)-3) when it should be returning (11/2)*exp(-t)+4*exp(-2*t)-(15/2)*exp(-3*t). The constants for the partital fraction decomposition seem to be wrong. What could the issue be with my code? I'm using it to double check my handwork for a dyanmic systems modeling class. Thanks in advance for any help!
(Answers Dev) Restored edit

Connectez-vous pour commenter.

Réponses (1)

Alan Stevens
Alan Stevens le 10 Août 2020

0 votes

The solution you think is correct does not satisfy the condition y`(0) = 0. It gives y`(0) = 9.
MATLAB's solution satisfies both initial conditions.

Catégories

En savoir plus sur Debugging and Improving Code dans Centre d'aide et File Exchange

Question posée :

le 10 Août 2020

Commenté :

le 7 Mai 2021

Community Treasure Hunt

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

Start Hunting!

Translated by