MATLAB: I want to use inverse laplace with tf function. How to do it? I take an error in matlab when ı use code like below.

ilaplacetf functiontf numden

A=[-2 0 ; 0 -1]
B=[1;2]
C=[1 1]
D=0;
P=ss(A,B,C,D)
syms s
F=tf(P)
ilaplace(F)

Best Answer

Try this:
A=[-2 0 ; 0 -1]
B=[1;2]
C=[1 1]
D=0;
P=ss(A,B,C,D)
syms s t
F=tf(P)
num = poly2sym(F.Numerator, s)
den = poly2sym(F.Denominator, s)
f(t) = ilaplace(num/den)
figure
fplot(f, [0,10])
grid
producing:
num =
3*s + 5
den =
s^2 + 3*s + 2
f(t) =
2*exp(-t) + exp(-2*t)
and the plot.