|
- N=2048; % 数据长度
- Fs=1/2048; % 采样频率
- n=0:N-1;
- x=cos(0.257*pi*n)+sin(0.2*pi*n) + 0.01*randn(size(n));
- % [url]http://cn.mathworks.com/help/signal/ref/pmusic.html[/url]中example
- %x=0.23*cos(2*pi*38.6*n)+cos(2*pi*40*n)+0.01*randn(size(n));
- figure(1)
- plot(n,x)
- xlabel('采样数据');ylabel('幅值');title('采样信号时域波形')
- figure(2)
- pmusic(x,4,N)
- [P,F]=pmusic(x,4,N,Fs); % [S,f]=pmusic(x,p,nfft,fs)
- k=(0:N/2)*Fs*2;
- figure(3)
- subplot(211)
- plot(F,20*log10(abs(P)))
- xlabel('频率 f/HZ');ylabel('幅值');title('MUSIC谱估计')
- subplot(212)
- plot(k,20*log10(abs(P)))
- grid on
- xlabel('频率 f/HZ');ylabel('幅值');title('MUSIC谱估计')
复制代码 |
|