I have the following code and am expecting the results of e and e1 to be same but the first element is not same. The reasoning behind this expectation is as follows:
RESID should be performing an inverse filter of the one that is estimated by the model. That is what I am trying to create by using the filter function. However, the resid probably is using or most likely assuming some Zi for the filter. No matter what it is doing one should be able to recreate what resid is doing using the filter command.
Reproduction steps:
x=filter([1],[1 -.9],randn(1,100)); m=armax(x',[1 0]) e=filter(m.a,m.c,x); e1=resid(m,x')
If you plot e and e1 you will see that other than the first element, they are essentially the same.
Best Answer