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

📄 untitled2.m

📁 功率谱估计,包括周期图法
💻 M
字号:
%对高斯白噪声n(t)中的信号x(t)=cos(2*pi*60*t)+cos(2*pi*63*t)+0.1*n(t),分别采用周期图法、Welch法、Burg法、
%Music法进行谱估计。其中fs=1000Hz,nfft=1024和2048,加窗类型自选。要求(1)画出x(t)的波形图(2)画出各种方法的谱估计
%图(3)对谱估计结果进行分析。
fs = 1000;   
t = 0:1/fs:1; 
s = cos(2*pi*60*t) + cos(2*pi*63*t);
w = 0.1*randn(size(t)); 
x = s + w;  
figure(1); plot(t,x); title('含噪声信号')
xlabel('t/s');
nfft1=1024; nfft2=2048;
figure(2); subplot(2,1,1); hp1=spectrum.periodogram('hamming'); psd(hp1,x,'nfft',nfft1,'fs',fs); title('周期图谱估计1024点');
           subplot(2,1,2); hp2=spectrum.periodogram('hamming'); psd(hp2,x,'nfft',nfft2,'fs',fs); title('周期图谱估计2048点');
figure(3); subplot(2,1,1); hw1 = spectrum.welch('hamming',64,50); psd(hw1,x,'nfft',nfft1,'fs',fs); title('welch谱估计1024点');
           subplot(2,1,2); hw2 = spectrum.welch('hamming',64,50); psd(hw2,x,'nfft',nfft2,'fs',fs); title('welch谱估计2048点');
figure(4); subplot(2,1,1); pburg(x,50,nfft1,fs); title('burg谱估计1024点');
           subplot(2,1,2); pburg(x,50,nfft2,fs); title('burg谱估计2048点');
figure(5); subplot(2,1,1); pmusic(x,2,nfft1,fs); title('music谱估计1024点');
           subplot(2,1,2); pmusic(x,2,nfft2,fs); title('music谱估计2048点');

⌨️ 快捷键说明

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