Given continuous analog signal xa(t)= e-100|t|. Write a MATLAB program to display its frequency spectra using FFT.
(Hints: To obtain the sampling signals x(n) = xa(nTs) , the sampling interval Tscan be less than 0.0025 sec)
close all; fs = 8000; f = 400; %Hz
t = 0:0025fs:1-1/fs; signal = sin(2*pi*f*t);
plot(t, signal); title('Time-Domain signal');
fftSignal = fft(signal);
fftSignal = fftshift(fftSignal);
f = fs/2*linspace(-1,1,fs);
figure; plot(f, abs(fftSignal)); title('magnitude FFT of sine'); xlabel('Frequency (Hz)'); ylabel('magnitude');
noise = 2*randn(size(signal)); figure, plot(t,noise), title('Time-Domain Noise'); fftNoise = fft(noise); fftNoise = fftshift(fftNoise); figure, plot(f,abs(fftNoise)), title('Magnitude FFT of noise'); xlabel('Frequency (Hz)'); ylabel('magnitude');
noisySignal = signal + noise; figure, plot(t,noisySignal), title('Time-Domain Noisy Signal'); fftNoisySignal = fft(noisySignal); fftNoisySignal = fftshift(fftNoisySignal); figure, plot(f,abs(fftNoisySignal)), title('Magnitude FFT of noisy signal'); xlabel('Frequency (Hz)'); ylabel('magnitude');
Get Answers For Free
Most questions answered within 1 hours.