前言
本篇文章介绍了如何使用MATLAB分析二阶系统
被控系统
x
¨
+
5
x
˙
+
6
x
=
F
\ddot{x}+5\dot{x}+6x=F
x¨+5x˙+6x=F
可以对上述系统进行拉式变化,得到传递函数为
G
=
1
s
2
+
5
s
+
6
G=\frac{1}{s^2+5s+6}
G=s2+5s+61
可以分析系统的伯德图,具体代码和图像如下:
s=tf('s');
G=1/(s^2+5*s+6);
bode(G)
输入正弦得到输出
t=0:0.05:10;
xt=1+5*cos(t);
lsim(G,xt,t)
已知输出得到输入
首先对输出进行Laplace变换而后进行反变换得到输入,但是在matlab中的输入会包含狄拉克函数项
syms s t;
y=0.1+0.5*cos(t);
Ys=laplace(y);
G=1/(s^2+5*s+6);
Xs=Ys/G;
xt=ilaplace(Xs)
输出为:
x
t
=
(
5
∗
c
o
s
(
t
)
)
/
2
+
3
∗
d
i
r
a
c
(
t
)
−
(
5
∗
s
i
n
(
t
)
)
/
2
+
(
3
∗
d
i
r
a
c
(
1
,
t
)
)
/
5
+
3
/
5
xt = (5*cos(t))/2 + 3*dirac(t) - (5*sin(t))/2 + (3*dirac(1, t))/5 + 3/5
xt=(5∗cos(t))/2+3∗dirac(t)−(5∗sin(t))/2+(3∗dirac(1,t))/5+3/5
同样也可以手动计算输入的幅值、相位差等,从而手动得到输入信号的表达式。