系统辨识 ARXmodel matlab仿真实验

ARX模型 matlab实现

      • The object model to be identified is:
      • The M program code is:
      • ARX response curves obtained by modeling and correlation analysis:

The object model to be identified is:

系统辨识 ARXmodel matlab仿真实验_第1张图片

Where v(k) is zero mean white noise. ARX modeling and correlation analysis were carried out for the above objects respectively, and impulse and step responses were obtained by comparing the two methods.The simulation curve is shown in figure 1.

The M program code is:

% Fourth order object ARX modeling and correlation analysis and comparison
clear;
clc;
clf;
A=[1 -0.4 0.5 0.2 0.1]; 
B=[0 1 0.6 0.3 0.2]; 
th0=poly2th(A,B) ; 
% th0 = Discrete-time ARX model:  A(z)y(t) = B(z)u(t) + e(t)
%  A(z) = 1 - 0.4 z^-1 + 0.5 z^-2 + 0.2 z^-3 + 0.1 z^-4               
%  B(z) = z^-1 + 0.6 z^-2 + 0.3 z^-3 + 0.2 z^-4  
u=idinput (500,'rbs'); 
% Generate a binary random signal
y=idsim ([u, randn(500,1)],th0); 
% Calculate the response of the system, th0 is the polynomial model established above, u is the input, randn is the noise.
z=[y u]; 
ir= cra(z); 
% Calculate the impulse response estimation of the system, where z = [y, u], that is to say, contains the output input information.
% At this point, the impulse response estimation has been completed, and the signal data is stored in the ir.
% The following is the impulse response directly obtained through simulation, which is used to verify the above results
th=arx (z,[4 4 1]) ; 
% This is an ARX model
% The following [4, 4, 1] represents the order of ar model
imp=[1;zeros(19,1)]; 
irth=idsim(imp,th); 
% Simulated Impulse responses
figure,plot(ir,'--') ;
hold on;
plot(irth,'r') 
legend('correlational analysis method','ARX modeling') 
title('Impulse responses') 
% Simulated Step responses
figure,plot(cumsum(ir),'--') ; 
hold on
plot(cumsum(irth),'y') 
legend('correlational analysis method','ARX modeling') 
title('Step responses')

ARX response curves obtained by modeling and correlation analysis:

系统辨识 ARXmodel matlab仿真实验_第2张图片
系统辨识 ARXmodel matlab仿真实验_第3张图片
系统辨识 ARXmodel matlab仿真实验_第4张图片

你可能感兴趣的:(matlab)