% % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; clc; clear; % EPage 137 dt = 0.1; y = [ 2, -0.404, 0.2346, 2.6687, -1.4142, -1.0973, 0.8478, -2.37, 0, ... 2.37, -0.8478, 1.0973, 1.4142, -2.6687, -0.2346, 0.404, -2, ... 1.8182, 1.7654, -1.2545, 1.4142, -0.3169, -2.8478, 0.9558, ... 0, -0.9558, 2.8478, 0.3169, -1.4142, 1.2545, -1.7654, -1.8182 ]; nt = length(y); T = dt * nt; t = 0:dt:(T-dt); df = 1/T; fmax = nt/(2*T); f = 0:df:df*(nt/2-1); Y = fft(y); Ys = zeros(1,nt/2); Ys(1:nt/2) = (2/nt)*Y(1:nt/2); plot( f, abs(Ys) ); xlabel('frequency Hz'); ylabel('abs(DFT)'); grid('on'); %saveas( gcf, '../../WriteUp/Graphics/Chapter7/c_7_p_12_plot.eps', 'epsc' );