diff --git "a/\345\210\230\346\237\257\347\277\224-20202320-\347\275\221\347\273\234\347\274\226\347\250\213\345\256\236\351\252\214\350\257\276" "b/\345\210\230\346\237\257\347\277\224-20202320-\347\275\221\347\273\234\347\274\226\347\250\213\345\256\236\351\252\214\350\257\276" new file mode 100644 index 0000000000000000000000000000000000000000..1fe2e4f625a17afc9f954acd2a164ad3747312da --- /dev/null +++ "b/\345\210\230\346\237\257\347\277\224-20202320-\347\275\221\347\273\234\347\274\226\347\250\213\345\256\236\351\252\214\350\257\276" @@ -0,0 +1,84 @@ +clc +clear +Fs = 6554; % Sampling frequency +T = 1/Fs; % Sample time +L = 20480; % Length of signal +t = (0:L-1)*T; % Time vector +y1=randn(size(t)); +figure(1) +subplot(2,1,1); + +plot(t,y1) +title('高斯序列') +d = randn(1,50); +y2=[y1(51:20480) d]; +subplot(2,1,2); +plot(t,y2) +title('高斯序列') +Wp = [300 400]/Fs*2; +Rp = 5; +Rs = 40; +[s,w,v]=cheby2(Rp,Rs,Wp,'bandpass'); %使用规范对象的切比雪夫II型滤波器 +[sos,g]=zp2sos(s,w,v); %将零极点增益滤波器参数转换为二阶截面形式 +hd=dfilt.df2tsos(sos,g); %离散时间,SOS直接形式II转置滤波器 +x1= filter(hd,y1) ; +x2= filter(hd,y2) ; +% x1 = awgn(x1,-2); +% x2 = awgn(x2,-2); +zs = wgn(1,L,-2); +Wp1 = [800 1500]/Fs*2; +[s,w,v]=cheby2(Rp,Rs,Wp1,'bandpass'); %使用规范对象的切比雪夫II型滤波器 +[sos,g]=zp2sos(s,w,v); %将零极点增益滤波器参数转换为二阶截面形式 +hd=dfilt.df2tsos(sos,g); %离散时间,SOS直接形式II转置滤波器 +zs = filter(hd,zs) ; + +figure(2) +subplot(2,1,1); + +plot(t,x1) +title('滤波后的x1') +subplot(2,1,2); +plot(t,x2) +title('滤波后的x2') +figure(3) +NFFT = 2^nextpow2(L); % Next power of 2 from length of y +Y = fft(x1,NFFT)/L; +f = Fs/2*linspace(0,1,NFFT/2+1); +% Plot single-sided amplitude spectrum. +subplot(2,1,1); +plot(f,2*abs(Y(1:NFFT/2+1))) +title('x1的频谱') +xlabel('频率 (Hz)') +ylabel('|Y(f)|') +Y = fft(x2,NFFT)/L; +f = Fs/2*linspace(0,1,NFFT/2+1); +% Plot single-sided amplitude spectrum. +subplot(2,1,2); +plot(f,2*abs(Y(1:NFFT/2+1))) +title('x2的频谱') +xlabel('频率 (Hz)') +ylabel('|Y(f)|') +x1 = x1+zs; +x2 = x2+zs; +figure(4) +NFFT = 2^nextpow2(L); % Next power of 2 from length of y +Y = fft(x1,NFFT)/L; +f = Fs/2*linspace(0,1,NFFT/2+1); +% Plot single-sided amplitude spectrum. +subplot(2,1,1); +plot(f,2*abs(Y(1:NFFT/2+1))) +title('加噪x1的频谱') +xlabel('频率 (Hz)') +ylabel('|Y(f)|') +Y = fft(x2,NFFT)/L; +f = Fs/2*linspace(0,1,NFFT/2+1); +% Plot single-sided amplitude spectrum. +subplot(2,1,2); +plot(f,2*abs(Y(1:NFFT/2+1))) +title('加噪x2的频谱') +xlabel('频率 (Hz)') +ylabel('|Y(f)|') +[A B] = xcorr(x1,x2,'biased'); +figure(5) +plot(B*T,A) +title('互相关系数') \ No newline at end of file diff --git "a/\351\202\223\351\223\204-20202308-\347\275\221\347\273\234\347\274\226\347\250\213\345\256\236\351\252\214\350\257\276" "b/\351\202\223\351\223\204-20202308-\347\275\221\347\273\234\347\274\226\347\250\213\345\256\236\351\252\214\350\257\276" new file mode 100644 index 0000000000000000000000000000000000000000..4499c0b5e97f43cd3972c661d09f3c9152541ffe --- /dev/null +++ "b/\351\202\223\351\223\204-20202308-\347\275\221\347\273\234\347\274\226\347\250\213\345\256\236\351\252\214\350\257\276" @@ -0,0 +1 @@ +随便写点东西吧 \ No newline at end of file