系统辨识理论及应用(课后题答案第三章3.2、3.3)国防工业出版社
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1、系统辨识——连续系统传递函数——脉冲传递函数function h=Continuous_system_transferFcn(N,G,dt)
% N——系统阶数
% G——采样数据(个数大于等于2N+1)
% G为一维行向量
% dt——采样间隔
if nargin<3
errordlg('not enough input varibles','error hint');
else
g_NN=zeros(N,N);
for i=1:N
g_NN(i,:)=G(i+1:i+1+N-1);
end
g_N=-G(1:N)';
a=inv(g_NN)*g_N;
%% x的求解
syms x
for i=1:N
X(i)=x^i;
end
f=X*a+1;
x=double(solve(f));
%%极点的求解
p=log(x)/dt;
c_NN=zeros(N,N);
for i=1:N
c_NN(i,:)=x.^(i-1);
end
c_N=G(1:N)';
%%增益求解
k=inv(c_NN)*c_N;
p
k
z=zeros(1,N);
p=p';
k=k';
Continuous_TransferFcn=0;
for i=1:N
Continuous_TransferFcn=Continuous_TransferFcn+zpk(z(i),p(i),k(i)); end
Continuous_TransferFcn
end
end
例题 3.1(P32)
>>G=[0 0.1924 0.2122 0.1762];
>> N=2;
>> dt=1;
>> Continuous_system_transferFcn(N,G,dt) p =
-0.4934
-0.7085
k =
1.6280
-1.6280
Continuous_TransferFcn =
0.35024 s
---------------------
(s+0.4934) (s+0.7085)
Continuous-time zero/pole/gain model.
习题3.2(P34)
>> G=[0 0.196 0.443 0.624 0.748 0.831]; >> N=3;
>> dt=0.2;
>> Continuous_system_transferFcn(N,G,dt) p =
-0.0633
-1.7846
-11.1860
k =
1.1249
-1.3399
0.2150
Continuous_TransferFcn =
-0.08507 s (s-253.1)
-------------------------------
(s+0.06329) (s+1.785) (s+11.19) Continuous-time zero/pole/gain model.
2 系统辨识——离散系统传递函数——脉冲传递函数
function h=Discrete_system_transferFcn(N,G,dt)
% N——系统阶数
% G——采样数据(个数大于等于2N+1)
% G为一维行向量
% dt——采样间隔
if nargin<3
errordlg('not enough input varibles','error hint');
else
g_NN=zeros(N,N);
for i=1:N
g_NN(i,:)=G(i+1:i+1+N-1);
end
g_N=-G(N+2:2*N+1)';
a1=inv(g_NN)*g_N;
a=zeros(N,1);
for j=1:N
a(j,1)=a1(N+1-j,1);
end
B=zeros(N+1,N+1);
B=diag(linspace(1,1,N+1));
for i=1:N+1
for j=1:N+1
if (i==j)&(i B(i+1:N+1,j)=a(1:N+1-i,1); end end end g__N=G(1:N+1)'; b=B*g__N; a b num=b'; den=[1 a']; Discrete_TransferFcn=tf(num,den,dt); Discrete_TransferFcn end end 例题 3.2(P33) >> G=[0 7.157039 9.491077 8.563839 5.930506 2.845972 0.144611]; >> N=3; >> dt=0.05; >> Discrete_system_transferFcn(N,G,dt) a = -2.2300 1.7606 -0.4950 b = 7.1570 -6.4691 -0.0009 Discrete_TransferFcn = 7.157 z^2 - 6.469 z - 0.0008933 -------------------------------- z^3 - 2.23 z^2 + 1.761 z - 0.495 Sample time: 0.05 seconds Discrete-time transfer function. 习题3.3(P34) >> G=[10 6.989 4.711 3.136 2.137 1.559 1.252 1.096 0.938 0.860]; >> N=3; >> dt=0.1; >> Discrete_system_transferFcn(N,G,dt) a = -2.1919 1.7166 -0.4794 b = 10.0000 -14.9295 6.5581 0.0139 Discrete_TransferFcn = 10 z^3 - 14.93 z^2 + 6.558 z + 0.01389 -------------------------------------- z^3 - 2.192 z^2 + 1.717 z - 0.4794 Sample time: 0.1 seconds Discrete-time transfer function.