% Generate Fig4 using decimaated RobotArm data:
load decimatedRobotArm
disp('Show Data')
plot(zd),shg
% Estimation and Validation data:

zde = zd(1:2048);
zdv = zd(2049:end);

disp('The default (TC-regularized with 5 AR parameters) FIR-model:')

mr = impulseest(zde,350);% 350 FIR parameters

% Evaluate simulation on validation data:

[~,fitr] = compare(zdv,mr,'ini','z');

disp('OE models of orders 1 to 35:')

for n = 1:35
    mo{n} = oe(zde,[n n 1]);
end

%Corresponding fits:

[~,fito] = compare(zdv,mo{:},'ini','z');
fitoe = max(cell2mat(fito),0);

disp('Show results')

plot([1:35],fitr*ones(35,1),'r',[1:35],fitoe),shg

title('Red: Regularized FIR fit.      Blue: OE-fits of different orders')
xlabel('OE model Order')


