PLEASE HELP!!!! I\'LL GIVE ALL MY POINTS(8250) TO YOU IF YOU GIVE ME CORRECT ANS
ID: 3557063 • Letter: P
Question
PLEASE HELP!!!! I'LL GIVE ALL MY POINTS(8250) TO YOU IF YOU GIVE ME CORRECT ANSWER...
WRITE A MATLAB CODE FOR FOLLOWING...
B. BY THE YULE-WALKER AR MODEL
MATLAB CODE...
Power Spectrum Estimation Generation of the random sequence x(n) of a known PSD: Generate a white Gaussian random sequence rw(n) of zero mean and variance sigma Pass the sequence through a digital filter to create an output sequence x(n). Now, the PSD of the sequence x(n) is to be estimated from a finite length of the sequence x(n) (say, N = 128).Explanation / Answer
A. THE WELCH NONPARAMETRIC METHOD:
clear all;
clc;
N=128;
L=8;
F=100;
variance=input('enter the variance');
D=input('enter value D');
WGN= sqrt(variance)*randn(N,1);
figure
plot(WGN);
title('White Gaussian Random Sequence (variiance=1, N=128)');
ylabel('r(n)');
xlabel('n');
num= [1];
den= [1 -0.9 0.81 -0.729];
H1= filt(num,den);
x= filter(num,den,WGN);
figure
plot(x);
title('Filtered Output Sequence');
ylabel('x(n)');
xlabel('n');
M= (N+D*(L-1))/L;
a=zeros(L,M);
for i=1:L
for j=1:M
a(i,j)=x((M-D)*(i-1)+j);
end
end
for n=1:M
w(n)=0.54-0.46*cos((2*pi*(n-1))/(M-1));
end
figure
plot(w);
title('Hamming Window');
ylabel('w(n)');
xlabel('n');
U=0;
for n=1:M
U=U+((w(n))^2)/M;
end
for i=1:L
p(i,:)=zeros(1,F);
f=-0.5:1/(F-1):0.5;
for j=1:M
p(i,:)=p(i,:)+a(i,j)*w(j)*exp(-1i*2*pi*f*(j-1));
end
for k=1:F
P(i,k)=((abs(p(i,k)))^2)/(M*U);
end
end
for k=1:F
Px(k)=0;
for i=1:L
Px(k)=Px(k)+(P(i,k))/L;
end
end
f=-0.5:1/(F-1):0.5;
figure
plot(f,Px);
title('Power Spectrum Density (No Overlapping: D=0)');
ylabel('PSD');
xlabel('frequency');
B. THE YULE-WALKER AR MODEL :
clear all;
clc;
N=128;
F=100;
variance=input('enter the variance ');
p=input('enter value of p ');
WGN= sqrt(variance)*randn(N,1);
figure
plot(WGN);
title('White Gaussian Random Sequence (variiance=1, N=128)');
ylabel('r(n)');
xlabel('n');
num1= [1];
den1= [1 -0.9 0.81 -0.729];
H1= filt(num1,den1);
x= filter(num1,den1,WGN);
figure
plot(x);
title('Filtered Output Sequence');
ylabel('x(n)');
xlabel('n');
for m=1:p+1
r(m)=0;
for n=1:N-m+1
r(m)=r(m)+(x(n)*x(n+m-1))/N;
end
end
for i=1:p
for j=1:p
R(i,j)=r(abs(i-j)+1);
end
end
R1=inv(R);
for i=1:p
R2(i,1)=-r(i+1);
end
a=R1*R2;
temp=0;
for i=1:p
temp=temp+a(i,1)*r(1,i+1);
end
var=r(1)+temp;
num2=[1];
den2=[1 transpose(a)];
H2= filt(num2,den2);
den3=zeros(1,F);
f=-0.5:1/(F-1):0.5;
for j=1:p
den3(1,:)=den3(1,:)+a(j)*exp(-1i*2*pi*j*f);
end
for i=1:F
P(i)=var/((abs(1+den3(1,i)))^2);
end
f=-0.5:1/(F-1):0.5;
figure
plot(f,P);
title('Power Spectrum Density (P=5)');
ylabel('PSD');
xlabel('frequency');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.