文档

ss2tf

将状态空间表示转换为传输功能

description

例子

[[b,,,,一种] = ss2tf(一种,,,,b,,,,C,,,,d将系统的状态空间表示转换为等效传输函数。ss2tf返回连续时间系统的Laplace-Transform传输函数和离散时间系统的Z-Transform传输函数。

例子

[[b,,,,一种] = ss2tf(一种,,,,b,,,,C,,,,d,,,,n一世返回传输函数,当n一世具有多个输入的系统的输入是由单位冲动激发的。

Examples

全部收缩

一维离散时间振荡系统由单位质量组成, m ,,,,一种tt一种Ched to a wall by a spring of unit elastic constant. A sensor samples the acceleration, 一种 ,质量 F s = 5 Hz。

生成50个时间样本。定义抽样间隔 Δ t = 1 / F s

FS = 5;dt = 1/fs;n = 50;t = dt*(0:n-1);

the oscillator can be described by the state-space equations

X (( k + 1 = 一种 X (( k + b (( k ,,,, y (( k = C X (( k + d (( k ,,,,

在哪里 X = (( r v t 是国家向量, r 一种nd v 分别是质量的位置和速度和矩阵

一种 = (( Cos Δ t Δ t - Δ t Cos Δ t ,,,, b = (( 1 - Cos Δ t Δ t ,,,, C = (( - 1 0 ,,,, d = (( 1

一种=[[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'

系统的传输函数具有分析表达:

H (( z = 1 - z - 1 (( 1 + Cos Δ t + z - 2 Cos Δ t 1 - 2 z - 1 Cos Δ t + z - 2

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, m 1 一种nd m 2 ,,,,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 一种 1 一种nd 一种 2 ,,,,the accelerations of the masses, at F s = 1 6 Hz。

指定总测量时间为16 s。定义抽样间隔 Δ t = 1 / F s

FS = 16;dt = 1/fs;n = 257;t = dt*(0:n-1);

该系统可以通过状态空间模型描述

X (( n + 1 = 一种 X (( n + b (( n ,,,, y (( n = C X (( n + d (( n ,,,,

在哪里 X = (( r 1 v 1 r 2 v 2 t 是国家向量和 r 一世 一种nd v 一世 一种re respectively the location and the velocity of the 一世 -th mass. The input vector = (( 1 2 t 和输出向量 y = (( 一种 1 一种 2 t 。州空间矩阵是

一种 = 经验 (( 一种 C Δ t ,,,, b = 一种 C - 1 (( 一种 - 一世 b C ,,,, C = (( - 2 0 1 0 1 0 - 2 0 ,,,, d = 一世 ,,,,

连续的时间空间矩阵是

一种 C = (( 0 1 0 0 - 2 0 1 0 0 0 0 1 1 0 - 2 0 ,,,, b C = (( 0 0 1 0 0 0 0 1 ,,,,

一种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);

第一个质量, m 1 ,接收到正方向的单位冲动。

你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, m 2 ,接收到正方向的单位冲动。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”兴奋) 网格

输入参数

全部收缩

状态矩阵,指定为矩阵。如果系统有p输入和输出,由nst一种te variables, then一种n-by-n

数据类型:单身的|双倍的

输入到状态矩阵,指定为矩阵。如果系统有p输入和输出,由nst一种te variables, thenbn-by-p

数据类型:单身的|双倍的

状态到输出矩阵,指定为矩阵。如果系统有p输入和输出,由nst一种te variables, thenC-by-n

数据类型:单身的|双倍的

进料矩阵,指定为矩阵。如果系统有p输入和输出,由nst一种te variables, thend-by-p

数据类型:单身的|双倍的

输入索引,指定为整数标量。如果系统有p输入,使用ss2tfwith a trailing argumentn一世= 1,…,,p计算对应用于单位冲动的响应n一世输入。

数据类型:单身的|双倍的

输出参数

全部收缩

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通过

    X (( k + 1 = 一种 X (( k + b (( k y (( k = C X (( k + d (( k

    传输函数是系统脉冲响应的Z变换。它可以用状态空间矩阵表示

    H (( z =C (( z 一世 - 一种 - 1 b + d

  • 对于连续的时间系统,状态空间矩阵与状态向量相关联X,输入和输出y通过

    X - = 一种 X + b y = C X + d

    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

    H (( s = C (( s 一世 - 一种 - 1 b + d

也可以看看

|||||

一世ntroduced before R2006a