1. 计算传递函数(或含未知数分式)加减乘除
命令行输入:
a=tf([1],[1 1])
a =
1
-----
s + 1
Continuous-time transfer function.
>> b=tf([1],[1 1])
b =
1
-----
s + 1
Continuous-time transfer function.
>> c=a+b
c =
2 s + 2
-------------
s^2 + 2 s + 1
Continuous-time transfer function.
>> d=a*b
d =
1
-------------
s^2 + 2 s + 1
Continuous-time transfer function.
2. 命令行用syms定义未知数x
>> syms t;
>> f=t
f =
t
>> fs=laplace(f)
fs =
1/s^2
3. c2d函数用于将s域传递函数化为z域
sysTF =
From input "\Delta CTemp" to output "\Delta PTemp":
0.00703
--------------------------
s^2 + 0.01304 s + 0.004581
Continuous-time identified transfer function.
Parameterization:
Number of poles: 2 Number of zeros: 0
Number of free coefficients: 3
Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties.
Status:
Estimated using TFEST on time domain data "data".
Fit to estimation data: 38.81%
FPE: 0.5506, MSE: 0.5505
>> sysTFz=c2d(sysTF,0.0002)
sysTFz =
From input "\Delta CTemp" to output "\Delta PTemp":
1.406e-10 z^-1 + 1.406e-10 z^-2
-------------------------------
1 - 2 z^-1 + z^-2
Sample time: 0.0002 seconds
Discrete-time identified transfer function.
Parameterization:
Number of poles: 2 Number of zeros: 2
Number of free coefficients: 4
Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties.
Status:
Created by direct construction or transformation. Not estimated.
注意,这里c2d函数第二个参数采样时间对应的单位是传递函数sysTF 的单位
4. 用tf()表示z域传递函数:
5. compare函数来比较数据
首先导入数值矩阵:
命令行操作:
定义输入输出向量:
>> u = Untitled2(:,2)
>> y = Untitled2(:,1)
再定义data变量,包含输入输出和采样时间:
>> data = iddata(y,u,0.0002)
定义传递函数 :
>> sys = tf([7.225e04 -1.112e08],[1 528.6 1.755e05 2.864e07])
执行compare()函数:
>> compare(sys,data)
输出如下(灰色为实测输出数据,蓝色为实测输入下的仿真输出):
6. 求最大值得横坐标
[u_max,t_max]=max(y);