将状态空间表示转换为传输功能
一维离散时间振荡系统由单位质量组成, ,,,,一种tt一种Ched to a wall by a spring of unit elastic constant. A sensor samples the acceleration, ,质量 Hz。
生成50个时间样本。定义抽样间隔 。
FS = 5;dt = 1/fs;n = 50;t = dt*(0:n-1);
the oscillator can be described by the state-space equations
在哪里 是国家向量, 一种nd 分别是质量的位置和速度和矩阵
一种=[[Cos(dt) sin(dt);-sin(dt) cos(dt)]; B = [1-cos(dt);sin(dt)]; C = [-1 0]; D = 1;
该系统沿正向的单位脉冲激发。使用状态空间模型从全零初始状态开始计算系统的时间演变。
你=[[1zeros(1,N-1)]; x = [0;0];为了k=1:N y(k) = C*x + D*u(k); x = A*x + B*u(k);结尾
Plot the acceleration of the mass as a function of time.
茎(t,y,'填充')Xlabel('t')
Compute the time-dependent acceleration using the transfer functionH((z)要过滤输入。绘制结果。
[b,a] = ss2tf(a,b,c,d);yt = filter(b,a,u);茎(t,yt,'填充')Xlabel('t')
系统的传输函数具有分析表达:
Use the expression to filter the input. Plot the response.
bf = [1 -(1+cos(dt)) cos(dt)]; af = [1 -2*cos(dt) 1]; yf = filter(bf,af,u); stem(t,yf,'填充')Xlabel('t')
the result is the same in all three cases.
一种n一世deal one-dimensional oscillating system consists of two unit masses, 一种nd ,,,,Confined between two walls. Each mass is attached to the nearest wall by a spring of unit elastic constant. Another such spring connects the two masses. Sensors sample 一种nd ,,,,the accelerations of the masses, at Hz。
指定总测量时间为16 s。定义抽样间隔 。
FS = 16;dt = 1/fs;n = 257;t = dt*(0:n-1);
该系统可以通过状态空间模型描述
在哪里 是国家向量和 一种nd 一种re respectively the location and the velocity of the -th mass. The input vector 和输出向量 。州空间矩阵是
连续的时间空间矩阵是
一种nd 表示适当大小的身份矩阵。
一种C=[[0100;-2 0 1 0;0 0 0 1;1 0 -2 0]; A = expm(Ac*dt); Bc = [0 0;1 0;0 0;0 1]; B = Ac\(A-eye(4))*Bc; C = [-2 0 1 0;1 0 -2 0]; D = eye(2);
第一个质量, ,接收到正方向的单位冲动。
你X=[[1zeros(1,N-1)]; u0 = zeros(1,N); u = [ux;u0];
Use the model to compute the time evolution of the system starting from an all-zero initial state.
x = [0; 0; 0; 0];为了k=1:N y(:,k) = C*x + D*u(:,k); x = A*x + B*u(:,k);结尾
将两个质量的加速度绘制为时间的函数。
茎(t,y',,'。')Xlabel('t') 传奇('a_1',,,,'a2')t一世tle('Mass 1 Excited') 网格
将系统转换为其传输函数表示。找到系统对第一个质量的阳性单位脉冲激发的响应。
[B1,A1] = SS2TF(A,B,C,D,1);y1u1 = filter(b1(1,:),a1,ux);y1u2 = filter(b1(2,:),a1,ux);
绘制结果。the transfer function gives the same response as the state-space model.
stem(t,[y1u1;y1u2]','。')Xlabel('t') 传奇('a_1',,,,'a2')t一世tle('Mass 1 Excited') 网格
系统重置为其初始配置。Now the other mass, ,接收到正方向的单位冲动。Compute the time evolution of the system.
u = [u0; ux];x = [0; 0; 0; 0];为了k=1:N y(:,k) = C*x + D*u(:,k); x = A*x + B*u(:,k);结尾
绘制加速度。单个质量的响应被切换。
茎(t,y',,'。')Xlabel('t') 传奇('a_1',,,,'a2')t一世tle(“质量2”兴奋) 网格
找到系统对第二个质量的阳性单位脉冲激发的响应。
[B2,A2] = SS2TF(A,B,C,D,2);Y2U1 =滤波器(B2(1,:),A2,UX);Y2U2 =滤波器(B2(2,:),A2,UX);
绘制结果。the transfer function gives the same response as the state-space model.
stem(t,[y2u1;y2u2]','。')Xlabel('t') 传奇('a_1',,,,'a2')t一世tle(“质量2”兴奋) 网格
一种
-State matrix状态矩阵,指定为矩阵。如果系统有p输入和问输出,由nst一种te variables, then一种
是n-by-n。
数据类型:单身的
|双倍的
b
-输入到状态矩阵输入到状态矩阵,指定为矩阵。如果系统有p输入和问输出,由nst一种te variables, thenb
是n-by-p。
数据类型:单身的
|双倍的
C
-State-to-output matrix状态到输出矩阵,指定为矩阵。如果系统有p输入和问输出,由nst一种te variables, thenC
是问-by-n。
数据类型:单身的
|双倍的
d
-进料矩阵进料矩阵,指定为矩阵。如果系统有p输入和问输出,由nst一种te variables, thend
是问-by-p。
数据类型:单身的
|双倍的
n一世
-一世np你t一世ndex输入索引,指定为整数标量。如果系统有p输入,使用ss2tf
with a trailing argumentn一世
= 1,…,,p计算对应用于单位冲动的响应n一世
输入。
数据类型:单身的
|双倍的
b
- 传输功能分子系数tr一种nsfer function numerator coefficients, returned as a vector or matrix. If the system hasp输入和问输出,由nst一种te variables, thenb
是问-by-((n+1)为了each input. The coefficients are returned in descending powers ofsorz。
一种
- 传输函数分母系数传递函数分母系数,作为向量返回。如果系统有p输入和问输出,由nst一种te variables, then一种
是1-by-((n+1)为了each input. The coefficients are returned in descending powers ofsorz。
For discrete-time systems, the state-space matrices relate the state vectorX,输入你和输出y通过
传输函数是系统脉冲响应的Z变换。它可以用状态空间矩阵表示
对于连续的时间系统,状态空间矩阵与状态向量相关联X,输入你和输出y通过
the transfer function is the Laplace transform of the system’s impulse response. It can be expressed in terms of the state-space matrices as
一种modified version of this example exists on your system. Do you want to open this version instead?
您单击了与此MATLAB命令相对应的链接:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。金宝app
You can also select a web site from the following list:
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。