该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
这个对应的是单输入单输出的。
多输入多输出的如下:
% Thansfer multiple transfer functions into sate space models
clc
clear all;
% Step1:输入传递函数分子分母系数
%From u1 to y1
num1=[-0.0006086 -7.715e-005];
den1=[1 1.079 0.2385 8.696e-005];
%From u2 to y1
num2=[0.03045 -0.0005537];
den2=[1 2.584 1.429 7.817e-005];
%From u1 to y2
num3=[3.135e-005 1.396e-007];
den3=[1 1.101 0.01934 5.657e-005];
%From u2 to y2
num4=[0.0003878 0.0001376];
den4=[1 0.6916 0.1158 0.003103];
% Step2:获得各单输入单输出状态空间模型
[A11,B11,C11,D11]=tf2ss(num1,den1);%From u1 to y1
[A21,B21,C21,D21]=tf2ss(num2,den2);%From u2 to y1
[A12,B12,C12,D12]=tf2ss(num3,den3);%From u1 to y2
[A22,B22,C22,D22]=tf2ss(num4,den4);%From u2 to y2
S_m11=ss(A11,B11,C11,D11);%From u1 to y1
S_m21=ss(A21,B21,C21,D21);%From u2 to y1
S_m12=ss(A12,B12,C12,D12);%From u1 to y2
S_m22=ss(A22,B22,C22,D22);%From u2 to y2
% Step3:按输入输出将状态空间模型写成矩阵形式,即为双输入双输出状态空间模型
P=[S_m11 S_m12;S_m21 S_m22];
% Step3:获得A,B,C,D矩阵
[A,B,C,D] = ssdata(P)