How to build a single input multiple output ARX or ARMAX model with MATLAB

17 次查看(过去 30 天)
I want to build a single input multiple output ARMAX model,then the AR coefficient is extracted.
for example
y is an array of 6 rows and 8192 columns,I'll take the first line as input and the last five as output。
The AR coefficient is 2 and the Ma coefficient is 3
This is my code:
sr=y(1,:)'; %input
sc=y(2:6,:); %output
u1 = iddata([], sr);
sc=sc';
yy = iddata(sc);
na=[2 2 2 2 2];
nb=[3];
nk=[0];
nc=[0];
sys = armax([yy u1],[na nb nk nc]);
xishu=sys.A;
But matlab prompts:
In the "armax" command, the number of rows in the orders matrix must be equal to the number of model outputs.
I don't know where I was wrong

采纳的回答

Rajiv Singh
Rajiv Singh 2020-8-25
Identification routines want variables to be arranged along the columns, time along rows. Your data "y" is transposed. Also, the order matrix dimensions are wrong (see documentation for the required sizes of orders). I would do something like this:
y = y';
ny = 5; % number of outputs
nu = 1; % number of inputs
data = iddata(y(:,2:6),y(:,1),1);
na = 2*eye(5); % note: na must be ny-by-ny!
nb = 3*ones(5,1); % nb must be ny-by-nu
nc = 0*ones(5,1); % nc must be ny-by-1
nk = zeros(5,1); % nk must be ny-by-nu
model = armax(data,[na nb nc nk])

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by