www.gusucode.com > signal 案例源码程序 matlab代码 > signal/SpecifyingSamplingFrequencyAndSubspaceDimensionsExample.m

    %% Specifying Sampling Frequency and Subspace Dimensions
% This example analyzes the same signal vector, |x|, with an eigenvalue
% cutoff of 10% above the minimum. Setting |p(1) = Inf| forces the
% signal/noise subspace decision to be based on the threshold parameter,
% |p(2)|. Specify the eigenvectors of length 7 using the |nwin| argument,
% and set the sampling frequency, |fs|, to 8 kHz:

% Copyright 2015 The MathWorks, Inc.


%%

rng default
n = 0:199;
x = cos(0.257*pi*n) + sin(0.2*pi*n) + 0.01*randn(size(n));
[P,f] = pmusic(x,[Inf,1.1],[],8000,7); % Window length = 7
plot(f,20*log10(abs(P)))
xlabel 'Frequency (Hz)', ylabel 'Power (dB)'
title 'Pseudospectrum Estimate via MUSIC', grid on