Thank you for your company , knowledge has no limit .

<>1, Let the observed values of ergodic stationary random signals be x ( n ) = x(n)= x(n)={1,-1,2,-2;n=0~3}; The period method and correlation method are used to estimate the power spectrum
P N ( w ) P_N(w)PN​(w), Verify its consistency .

Periodogram method :
① First find the signal spectrum function X N ( e j w ) = ∑ n = 0 N − 1 x ( n ) e − j w n
X_N(e^{jw})=\sum\limits_{n=0}^{N-1}x(n)e^{-jwn}XN​(ejw)=n=0∑N−1​x(n)e−jwn
② Further calculation of power spectral density P N ( w ) = 1 N ∣ X N ( e j w ) ∣ 2
P_N(w)=\dfrac{1}{N}|X_N(e^{jw})|^2PN​(w)=N1​∣XN​(ejw)∣2

Autocorrelation method :
① First, the sequence autocorrelation function is obtained in time domain r N ( m ) = 1 N x N ( m ) ∗ x N ∗ ( − m ) = 1 N ∑ n = 0 N − 1
x N ( n ) x N ( n − m )
r_N(m)=\dfrac{1}{N}x_N(m)*x^*_N(-m)=\dfrac{1}{N}\sum\limits_{n=0}^{N-1}x_N(n)x_N(n-m)
rN​(m)=N1​xN​(m)∗xN∗​(−m)=N1​n=0∑N−1​xN​(n)xN​(n−m)
② The power spectral density is obtained by Fourier transform P N ( w ) = ∑ m = 1 − N N − 1 r N ( m ) e − j w n
P_N(w)=\sum\limits_{m=1-N}^{N-1}r_N(m)e^{-jwn}PN​(w)=m=1−N∑N−1​rN​(m)e−jwn

Periodogram estimation method :

x 4 ( n ) = { 1 , − 1 , 2 , − 2 }       N = 4 x_4(n)=\{1,-1,2,-2\} \ \ \ \ \
N=4x4​(n)={1,−1,2,−2}     N=4

X 4 ( e j w ) = ∑ n = 0 3 x ( n ) e − j w n = 1 − e − j w + 2 e − j 2 w − 2 e
− j 3 w
X_4(e^{jw})=\sum\limits_{n=0}^{3}x(n)e^{-jwn}=1-e^{-jw}+2e^{-j2w}-2e^{-j3w}X4​(e
jw)=n=0∑3​x(n)e−jwn=1−e−jw+2e−j2w−2e−j3w

                = ( 1 − c o s w + 2 c o s 2 w − 2 c o s 3 w ) + j ( s i n w −
2 s i n 2 w + 2 s i n 3 w ) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
=(1-cosw+2cos2w-2cos3w)+j(sinw-2sin2w+2sin3w)               =(1−cosw+2cos2w−2cos
3w)+j(sinw−2sin2w+2sin3w)

P 4 ( w ) = 1 4 [ ( 1 − c o s w + 2 c o s 2 w − 2 c o s 3 w ) 2 + ( s i n w −
2 s i n 2 w + 2 s i n 3 w ) 2 ]
P_4(w)=\dfrac{1}{4}[(1-cosw+2cos2w-2cos3w)^2+(sinw-2sin2w+2sin3w)^2]P4​(w)=41​[(
1−cosw+2cos2w−2cos3w)2+(sinw−2sin2w+2sin3w)2]

through too product turn and difference : c o s α c o s β + s i n α s i n β = c o s ( α − β )
By integrating sum and difference :cos\alpha cos\beta+sin\alpha sin\beta=cos(\alpha-\beta) By integrating sum and difference :cosαcosβ+si
nαsinβ=cos(α−β)

most after can turn simple have to : P 4 ( w ) = 1 4 ( − 4 c o s 3 w + 8 c o s 2 w − 14 c o s w + 10
) Finally, it can be reduced to :P_4(w)=\dfrac{1}{4}(-4cos3w+8cos2w-14cosw+10) Finally, it can be reduced to :P4​(w)=41​(−4cos3w+
8cos2w−14cosw+10)

Autocorrelation estimation

from to x 4 ( n ) by real order column , place with x ∗ ( − n ) = x ( − n )
because x_4(n) Is a real sequence , therefore x^*(-n)=x(-n) because x4​(n) Is a real sequence , therefore x∗(−n)=x(−n)

r 4 ( m ) = x ( m ) ∗ x ( − m ) = 1 4 ∑ n = 0 3 x 4 ( n ) x 4 ( n − m )
r_4(m)=x(m)*x(-m)=\dfrac{1}{4}\sum\limits_{n=0}^{3}x_4(n)x_4(n-m)r4​(m)=x(m)∗x(−
m)=41​n=0∑3​x4​(n)x4​(n−m)

r 4 ( m ) = 1 4 { − 2 , 4 , − 7 , 10 , − 7 , 4 , − 2 }      m = − 3 , − 2 , .
. , 2 , 3 r_4(m)=\dfrac{1}{4}\{-2,4,-7,10,-7,4,-2\}\ \ \ \ m=-3,-2,...2,3r4​(
m)=41​{−2,4,−7,10,−7,4,−2}    m=−3,−2,...2,3

P 4 ( w ) = ∑ m = − 3 3 r 4 ( m ) e − j w m
P_4(w)=\sum\limits_{m=-3}^{3}r_4(m)e^{-jwm}P4​(w)=m=−3∑3​r4​(m)e−jwm

             = 1 4 ⋅ ( − 2 e j 3 w + 4 e j 2 w − 7 e j w + 10 − 7 e − j w + 4
e − j 2 w − 2 e − j 3 w ) \ \ \ \ \ \ \ \ \ \ \ \
=\dfrac{1}{4}\cdot(-2e^{j3w}+4e^{j2w}-7e^{jw}+10-7e^{-jw}+4e^{-j2w}-2e^{-j3w})  
          =41​⋅(−2ej3w+4ej2w−7ejw+10−7e−jw+4e−j2w−2e−j3w)

             = 1 4 [ − 2 ( e j 3 w + e − j 3 w ) + 4 ( e j 2 w + e − j 2 w )
− 7 ( e j w + e − j w ) + 10 ] \ \ \ \ \ \ \ \ \ \ \ \
=\dfrac{1}{4}[-2(e^{j3w}+e^{-j3w})+4(e^{j2w}+e^{-j2w})-7(e^{jw}+e^{-jw})+10]    
        =41​[−2(ej3w+e−j3w)+4(ej2w+e−j2w)−7(ejw+e−jw)+10]

             = 1 4 ( − 4 c o s 3 w + 8 c o s 2 w − 14 c o s w + 10 ) \ \ \ \
\ \ \ \ \ \ \ \ =\dfrac{1}{4}(-4cos3w+8cos2w-14cosw+10)            =41​(−4cos3w+
8cos2w−14cosw+10)

Matlab Draw and verify the power spectrum image of them :

Matlab code :
clc; clear; close all; xn=[1,-1,2,-2]; N=length(xn); rm=xcorr(xn); % Computational autocorrelation
figure('name',' Power spectrum estimation '); B=xn; A=1; [H1,w]=freqz(B,A,'whole'); subplot(2,2,1);
plot(w/pi,1/N*(abs(H1)).^2,'r'); xlabel('\omega/\pi');ylabel('P_4(\omega)');
grid on;title(' Periodogram estimation '); B=rm/N; A=1; [H2,w]=freqz(B,A,'whole'); subplot(2,2,2);
plot(w/pi,abs(H2),'b'); xlabel('\omega/\pi');ylabel('P_4(\omega)');grid on;title
(' Autocorrelation estimation '); P1=0.25*((1-cos(w)+2*cos(2*w)-2*cos(3*w)).^2+(-sin(w)+2*sin(2*w)-2*
sin(3*w)).^2); % Periodogram estimation results P2=0.25*(-4*cos(3*w)+8*cos(2*w)-14*cos(w)+10); % Autocorrelation estimation results
subplot(2,2,3);plot(w/pi,P1,'r'); xlabel('\omega/\pi');ylabel('P_4(\omega)');
grid on;title(' Periodogram estimation '); subplot(2,2,4);plot(w/pi,P2,'b'); xlabel('\omega/\pi');
ylabel('P_4(\omega)');grid on;title(' Autocorrelation estimation ');

Technology
©2019-2020 Toolsou All rights reserved,
VUE+Canvas Achieve desktop Pinball brick elimination games C/C++ Memory model 2019PHP Interview questions ( Continuously updated )PHPspringboot2 Separation of front and rear platforms ,token Put in header Pit for verification Vue SpringBoot conduct Excel download element-ui Step on pit record 45 The 12-year-old programmer was turned down , Is the workplace wrong ?Python Web frame Pandas Fundamentals of statistical analysis _ data processing (DataFrame Common operations )Java Misunderstanding —— Method overloading is a manifestation of polymorphism ?