# correlated interference related to gaussian autoregressiv

3 views (last 30 days)
MUDASSAR RAZA on 11 Jan 2023
Answered: Mathieu NOE on 11 Jan 2023
how can i generate the sequence of following equation
phi1=1.98;
phi2=-0.9801;
I(k)=phi1*i(k-1)+phi2*i(k-2)+e(k)
k=2:100
....i(-1),i(-2)......<0 are equal to zero
e(k)=white gaussian noise with variance 0.01

Mathieu NOE on 11 Jan 2023
hello
weel, you where not very far from the code....
here is it
NB that the for loop start at indice 3 because matlab works with indices starting at 1 and not zero
phi1=1.98;
phi2=-0.9801;
samples = 100;
e = randn(samples,1); % e(k)=white gaussian noise with variance 0.01
v = var(e); % check variance
v_target = 0.01;
amp = sqrt(v_target/v); % compute amplitude factor correction to get target variance
e = e*amp;
v = var(e) % now we have the correct variance
v = 0.0100
% init I
I(1) = e(1); % ....i(-1),i(-2)......<0 are equal to zero
I(2) = phi1*I(1)+ 0 +e(2);
% main loop
for k=3:samples
I(k) = phi1*I(k-1)+phi2*I(k-2)+e(k);
end
plot(I); ### Categories

Find more on Multivariate Models in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!