Not to worry, the below works.
%%AR(2)
c = 0;
phi = [3/2, -3/4];
x(1)=0;
x(2)=0;
for t=3:n
x(t) = c + phi(1)*x(t-1) + phi(2)*x(t-2) + y(t);
end
plot(x, '-');
xlabel('t','fontsize',15);
ylabel('X(t)', 'fontsize', 15);
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!