TailCorr/script_m/exzfft_ma.m

24 lines
983 B
Matlab
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function [y,freq,c]=exzfft_ma(x,fe,fs,nfft,D)
nt=length(x); % ¼ÆËã¶ÁÈëÊý¾Ý³¤¶È
fi=fe-fs/D/2; % ¼ÆËãϸ»¯½ØÖ¹ÆµÂÊÏÂÏÞ
fa=fi+fs/D; % ¼ÆËãϸ»¯½ØÖ¹ÆµÂÊÉÏÏÞ
na=round(0.5 * nt/D+1); % È·¶¨µÍͨÂ˲¨Æ÷½ØÖ¹ÆµÂʶÔÓ¦µÄÆ×ÏßÌõÊý
% ÆµÒÆ
n=0: nt-1; % ÐòÁÐË÷ÒýºÅ
b=n*pi* (fi+fa)/fs; % ÉèÖõ¥Î»ÐýתÒò×Ó
y=x.*exp(-1i*b); % ½øÐÐÆµÒÆ
b= fft(y, nt); % FFT
% µÍͨÂ˲¨ºÍϲÉÑù
a(1: na) =b(1: na); % È¡ÕýƵÂʲ¿·ÖµÄµÍƵ³É·Ö
a(nt-na+2 : nt) =b(nt-na+2 : nt); % È¡¸ºÆµÂʲ¿·ÖµÄµÍƵ³É·Ö
b=ifft(a, nt); % IFFT
c=b(1 : D: nt); % ϲÉÑù
% Çóϸ»¯ÆµÆ×
y=fft(c, nfft) * 2/nfft;% ÔÙÒ»´ÎFFT
y=fftshift(y); % ÖØÐÂÅÅÁÐ
freq=fi+(0:nfft-1)*fs/D/nfft; % ƵÂÊÉèÖÃ
figure
plot(freq,20*log10(y))
grid on