⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 5-9.m

📁 经典数字信号处理滤波器的源代码 重点是利用巴特沃斯模拟滤波器转而设计其它数字滤波器
💻 M
字号:
%例程5-9  利用Welch法估计功率谱
% e.g.5-9.m for example5-9;
% to test function pwelch;
 
clear all;
% Generate the signal with noise and display
N=1024;
n=0:1/(N-1):1;
f1=0.1;
f2=0.9;
wn=randn(1,N);
xn=sin(2*pi*f1*n)+2*cos(2*pi*f2*n)+wn;
subplot(211);
plot(n,xn); xlabel('n');
grid on;
title(' xn=sin(2*pi*f1*n)+2*cos(2*pi*f2*n)+wn');

% Set parameter
nfft=1024;
window=blackman(256);
noverlap=128;
range='oneside';
% Estimate the PSD 
[Pxx,f]=pwelch(xn,window,noverlap,nfft,N-1,range);
f=(0:length(Pxx)-1)/length(Pxx);
subplot(212);
plot(f,10*log10(Pxx)); 
xlabel('Frequency(Hz)');
ylabel('Power Spectrum(dB)');
title('Use Pwelch Function(Pxx(f)/(N-1)');
grid;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -