www.gusucode.com > signal 案例源码程序 matlab代码 > signal/SFDRFromPeriodogramExample.m
%% SFDR from Periodogram % Obtain the power spectrum of a 10 MHz tone with amplitude 1 sampled at % 100 MHz. There is a spur at the 1st harmonic (20 MHz) with an amplitude % of $3.16\times10^{-4}$. Use the one-sided power spectrum and a vector of % corresponding frequencies in Hz to compute the SFDR. % Copyright 2015 The MathWorks, Inc. deltat = 1e-8; fs = 1/deltat; t = 0:deltat:1e-6-deltat; x = cos(2*pi*10e6*t)+3.16e-4*cos(2*pi*20e6*t); [sxx,f] = periodogram(x,rectwin(length(x)),length(x),fs,'power'); r = sfdr(sxx,f,'power'); %% % Display the spectrum of the signal. Annotate the fundamental, the DC % value, the first spur, and the SFDR. sfdr(sxx,f,'power');