the reult is different using `ilaplace` and `lsim `

3 次查看(过去 30 天)
i just want to get the output when i know the input signal and trans fer function however when i use 2 methods they are different,codes are as this
method 1
syms t s
gs=(s)/(s^2 + 2*s +1);
us= laplace(sin(t + pi/6), t, s);
xs = us*gs;
xt = ilaplace(xs, s, t)
t=0:0.1:50;
xt2=cos(t)/4 + sin(t)/4 - (3^(1/2)*cos(t))/4 + (3^(1/2)*sin(t))/4 + exp(-t)*(3^(1/2)/4 - 1/4);
plot(t,xt2,'b')
method 2
num=[1,0];
den=[1,2,1]
sys=tf(num, den);
t=0:0.1:50;
u=sin(t+pi/6);
y=lsim(sys, u,t);
plot(t,y,'r')
and when i plot them together the result is as this together.png
  1 个评论
David Goodmanson
David Goodmanson 2019-12-23
Hi d^2,
I'm not sure where xt2 is coming from, but in the first method, plotting xt gives a result that looks very close to the lsim method. I don't have access to lsim so I can't say if the agreement is identical but it looks really close.
xt2 doesn't look right because gs has a double pole and xt2 does not have a t*e^(-t) term, whereas xt does.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by