Reproducing MISO ARX model results

4 visualizzazioni (ultimi 30 giorni)
sam
sam il 23 Dic 2016
I'm stuck at reproducing MISO ARX model results as I'd like to understand the matlab built-in function better. Down is the code with a MISO model with iodelay (nk) in first channel. When I study the case with no delay, the match between matlab built-in function and simulated one are perfect. But with the delays, the match is not even close. Can anyone tell me please where did I go wrong? Thanks.
clearvars, close all
%%Reference ARX model
A = [1 -1.5 0.7];
B = [0 0 0.0001 1 0.5; 0.1 1.2 0.3 0 0];
m = idpoly(A,B);
%%Generating data for comparison
u = iddata([],[idinput(300,'rbs') idinput(300,'rbs')]);
% --- ARX simulation for the reference
y = sim(m,u);
z = [y,u];
%%Reproduction/simulation of the ARX results
idxA = numel(A) : -1 : 1;
idxB = numel(B(1,:)) : -1 : 1;
for ct=(1+numel(B(1,:))):numel(z.u(:,1))
idxA = idxA + 1;
idxB = idxB + 1;
y_(ct) = z.u(idxB,1)' * B(1,:)' + z.u(idxB,2)' * B(2,:)' - z.y(idxA(2:end))' * A(2:end)';
end
% --- plot results
figure,plot([z.y y_']),legend('ref','reproduced'); grid on;zoom on;

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by