% AMBEx14_2b_aliasing Test aliasing Ambardar p 450; % Use fft and label graph with gtext ts=1/10 % S=10 so Fmax is 5 Hz t=[0:ts:100]; % The time period is 100 seconds so the resolution % in f is 1/100 hertz. % Note: The point 100 would represent 1Hz and the point 400 is 4Hz. % N=length(t) % N=101 xt=8*cos(2*pi*t)+6*cos(8*pi*t)+4*cos(22*pi*t); % f=1,4,11 Hz % % Check spectrum % Approximate the Fourier series with 1/N * |FFT|; Amb p547 Xf=(1/N)*abs(fft(xt)); Nplot=ceil(N/2+1) % Make sure number of points is an integer plot(2*Xf(1:Nplot)) % Plot 2x |FFT| title('Aliased result: f actual= 1,4,11 Hz; S=10; fa=11-10=1Hz') ylabel('Amplitude') xlabel('Frequency in Hz is 1/100 * index') gtext('xt=8*cos(2*pi*t)+6*cos(8*pi*t)+4*cos(22*pi*t); f=1,4,11 Hz') gtext('Note that the 11Hz signal is added to the 1Hz result (8+4=12)')