10.3k views
3 votes
This problem demonstrates aliasing. Generate a 512-point waveform consisting of 2 sinusoids at 200 and 400-Hz. Assume a sampling frequency of 1 kHz. Generate another waveform containing frequencies at 200 and 900-Hz. Take the Fourier transform of both waveforms and plot the magnitude of the spectrum up to fs/2. Plot the 2 spectra superimposed, but in different colors to highlight the additional peak due to aliasing at 100-Hz.

1 Answer

4 votes

Answer and Explanation:

clear all; close all;

N=512;

t=(1:N)/N;

fs=1000;

f=(1:N)*fs/N;

x= sin(2*pi*200*t) + sin(2*pi*400*t);

y= sin(2*pi*200*t) + sin(2*pi*900*t);

for n = 1:20

a(n) = (2/N)*sum(x.*(cos(2*pi*n*t)))

b(n) = (2/N)*sum(x.*(sin(2*pi*n*t)))

c(n) = sqrt(a(n).^2+b(n).^2)

theta(n) =-(360/(2*pi))*atan(b(n)./a(n));

end

plot(f(1:20),c(1:20),'rd');

disp([a(1:4),b(1:4),c(1:4),theta(1:4)])

User Asaf R
by
6.1k points