Laplace transform not getting Value

I tried to solve lapalce but not getting the value (Xs). Find the code below, Is there any issues in the code?
syms x(t) Xs
eqn = diff(x,t,2)+2*diff(x,t)+26*x(t) == 10*cos(t)*(heaviside(t-pi));
eqnLT = laplace(eqn)
eqnLT = 
eqnLT = subs(eqnLT,laplace(x(t)), Xs);
eqnLT = subs(eqnLT, {x(0), diff(x(t), t, 0)}, {1/2,1});
Xs = solve(eqnLT, Xs)
Xs = 

 Accepted Answer

I do not see any specific problems.
syms x(t) Xs s
eqn = diff(x,t,2)+2*diff(x,t)+26*x(t) == 10*cos(t)*(heaviside(t-pi));
eqnLT = laplace(eqn)
eqnLT = 
eqnLT = subs(eqnLT,laplace(x(t)), Xs);
eqnLT = subs(eqnLT, {x(0), diff(x(t), t, 0)}, {1/2,1})
eqnLT = 
Xs = isolate(eqnLT, Xs)
Xs = 
X(s) = rhs(Xs)
X(s) = 
Perhaps the isolate function will do what you want.
.

4 Comments

Need to plot using below getting error:" Input must be a function handle or symbolic function." while using isolate
figure(1)
fplot(Xs, [-10 100])
The equation needs to be set up correctly, and here it is not.
There is a typographical error in:
eqnLT = subs(eqnLT, {x(0), diff(x(t), t, 0)}, {1/2,1})
since it should be:
eqnLT = subs(eqnLT, {x(0), subs(diff(x(t), t), t, 0)}, {1/2,1});
and with that change:
syms x(t) Xs s X(s)
eqn = diff(x,t,2)+2*diff(x,t)+26*x(t) == 10*cos(t)*(heaviside(t-pi));
eqnLT = laplace(eqn);
eqnLT = subs(eqnLT,laplace(x(t)), X(s));
eqnLT = subs(eqnLT, {x(0), subs(diff(x(t), t), t, 0)}, {1/2,1});
eqnLT = isolate(eqnLT, X(s))
eqnLT = 
It does not eimplify further. (I checked.)
.
Wow! It helps me a lot! Thanks!
As always, my pleasure!
.

Sign in to comment.

More Answers (1)

syms x(t) Xs
eqn = diff(x,t,2)+2*diff(x,t)+26*x(t) == 10*cos(t)*(heaviside(t-pi));
eqnLT = laplace(eqn)
eqnLT = 
eqnLT = subs(eqnLT,laplace(x(t)), Xs);
dx = diff(x,t);
eqnLT = subs(eqnLT, {x(0), dx(0)}, {1/2,1});
Xs = solve(eqnLT, Xs)
Xs = 

1 Comment

%write a matlab code to find the solution of following differential
%equation using Laplace transform method
%d^2y/dx^2-3dy/dx+2y=sinx, y(0)=2, y'(0)=2

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!