views:

40

answers:

1

I used ARX function then RESID function from the System Identification Toolbox, but the resulting residuals are:

0 
0
0
5
6
8
7
8

the number of zeros=the number of lags, I need a complete vector of residuals

A: 

An AR model of order N needs the previous N values to predict the next one, which is why the first N are not predicted. You can always pad the vector at the beginning (either by replication or zeros), example:

load twotankdata
order = 5;
m = arx(y, order);

r = resid([y(1:order);y], m);
r = r(order+1:end);
Amro