In MATLAB, If I've some signal x
let say
x = rand(1,1000)
and I want to generate y
by filtering x
using Autoregressive (AR) filter of order M
. How can I find y(n)
? as autoregressive filter needs past values of output for calculation, but I don't have any past output yet. I only have input samples x
.
In Moving average (MA) filter I can generate y(n)
easily because it only needs past inputs which I can provide easily because we have x
, as follows
for n=1:1000
sum=0;
for k=1:M+1
if (n-k+1>0)
sum = sum + (1/M)*x(n-k+1); % MA depends on current & previous input
end
end
y(n)=sum;
end
Can anyone please help me to generate the same for the Autoregressive filter?