📄 c10ex16.m
字号:
% Implementation of the chirp-z transform of a pulse signal and% comparison with the corresponding results for the FFT - Example 10-16%clftheta_0 = input('Enter starting point, theta_0, on unit circle in radians ');phi_0 = input('Enter frequency resolution, phi_0, around unit circle in radians ');N = input('Enter total number of points for pulse signal ');N_pulse = input('Enter number of nonzero points for pulse signal ');M = input('Enter number of frequency cells for chirp-z transform ');W = exp(-j*phi_0);A = exp(j*theta_0);n = 0:N-1;m = 0:M-1;x = zeros(size(1:N));for nn = 1:N_pulse x(nn) = 1;endk = 1:M;T = A.*W.^(-(k-1));Y = ones(size(T)); % Form matrix of (AW^(-1))^(k*n); k = columns & n = rowsfor nn = 2:N Y = [Y; T.^(nn-1)];endX_chirp = x*Y; % Use matrix multiply to compute chirp-z sumX_FFT = fft(x); % Compute FFT for comparison% Shift chirp-z and set up axes in plot to make direct comparison% between chirp-z and FFT results.NN = 2*pi/phi_0-1;zz = zeros(size(1:theta_0*(NN+1)/(2*pi)));X_chirp = [zz X_chirp];L = length(X_chirp);l = 0:L-1;subplot(3,1,1),stem(n,x),axis([0 N-1 0 1]),xlabel('n'),ylabel('x(n)')subplot(3,1,2),stem(l,abs(X_chirp)),axis([0 NN-1 0 N_pulse]),xlabel('k_chirp'),... ylabel('Magn. of chirp-z'),... text(NN/2,.7*N_pulse,['Resolution = ',num2str(phi_0),' radians'])subplot(3,1,3), stem(n,abs(X_FFT)), axis([0 N-1 0 N_pulse]),xlabel('k_FFT'),... ylabel('Magn. of FFT')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -