Least square parameter estimation of MIMO ARX model

16 ビュー (過去 30 日間)
xuan
xuan 2021 年 4 月 27 日
編集済み: Ivo Houtzager 2021 年 9 月 22 日
I know that the ARX function in Matlab can estimate the parameters of the multi input multi output ARX model.
But I can't find the estimated main program when I open ARX function.
I want to find a program to estimate the parameters of MIMO ARX model with least square method.
I came to ask for help.

回答 (1 件)

Ivo Houtzager
Ivo Houtzager 2021 年 9 月 22 日
編集済み: Ivo Houtzager 2021 年 9 月 22 日
Example script to obtain the parameters of a MIMO ARX model (VARX) using least squares.
N = 1000; % number of samples
p = 5; % past window of VARX model
directfeedthrough = 1; % VARX model includes direct feedthrough
r = 2; % number of inputs
l = 3; % number of outputs
u = randn(r,N); % input data
y = randn(l,N); % output data
% concatenate the past data vectors
m = r+l;
z = [u; y];
Z = zeros(p*m,N-p);
for i = 1:p
Z((i-1)*m+1:i*m,:) = z(:,i:N+i-p-1);
end
% solve VARX problem
Y = y(:,p+1:N);
U = u(:,p+1:N);
if directfeedthrough
Z = [Z; U];
end
VARX = Y/Z; % least squares estimate
% convert solution to idpoly object
A = cell(l,l);
B = cell(l,r);
if directfeedthrough
VARX0 = [VARX eye(l)];
else
VARX0 = [VARX zeros(l,r) eye(l)];
end
for i = 1:l
for j = 1:l
A{i,j} = fliplr(VARX0(i,r+j:m:m*p+r+j));
end
for k = 1:r
B{i,k} = fliplr(VARX0(i,k:m:m*p+k));
end
end
Ts = 1; % sample time
E = Y - VARX*Z;
NoiseVariance = cov(E');
sys = idpoly(A,B,[],[],[],NoiseVariance,Ts); % MIMO ARX model object
For larger models, the least squares problem can become ill conditioned and would require regularization to get good estimate. If regularization is needed, I recommend to look at source code of the following matlab function.

カテゴリ

Help Center および File ExchangeNonlinear ARX Models についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by