Morgan State University Discrete Systems Project Worksheet
Description
Exercise 1: Filtering a random signal by direct convolution
Write a MATLAB program to
(a) Generate a random input signal of 50 samples whose amplitude is uniformly distributed between -4 and 5;
(b) Process the input signal by direct convolution using the following filter impulse response:
h(n) = {1/8, 1/4, 1/4, 1/4, 1/8}
(c) Plot the input and output signals on the same graph and explain what the filtering effect is.
Exercise 2: Filtering a multi-frequency signal
Lets consider the following analog signal
x(t) = 0.3sin(4000?t)+sin(10000?t)+0.4sin(16000?t)
Write a MATLAB program to
(a) Sample the analog signal at 60 kHz for a duration of 10 msec.
(b) Process the input signal using the given filter impulse response h in the given code (see attached additional sample codes).
(c) Plot the input and output signals (as function of time) on the same figure using the stem and plot functions.
Exercise 3: Noise filtering using Fast Fourier Transform
(a) Create a signal with sum of two sinusoids and add some noise.
Sample code:
dt = .001;
t = 0:dt:1;
f = sin(2*pi*50*t) + sin(2*pi*120*t); % Sum of 2 frequencies
f = f + 2.5*randn(size(t)); % Add some noise
(b) Plot the original signal (before noise is added) and plot the noisy signal.
(c) Compute the Fast Fourier Transform of the noisy signal and its Power Spectral Density
Sample code:
n = length(t);
fhat = fft(f,n); % Compute the fast Fourier transform
PSD = fhat.*conj(fhat)/n; % Power spectrum (power per freq)
freq = 1/(dt*n)*(0:n); % Create x-axis of frequencies in Hz
L = 1:floor(n/2); % Only plot the first half of freqs
(d) Use the Power Spectral Density to filter out noise
Sample code:
indices = PSD>100; % Find all freqs with large power
PSDclean = PSD.*indices; % Zero out all others
fhat = indices.*fhat; % Zero out small Fourier coeffs.
ffilt = ifft(fhat); % Inverse FFT for filtered time signal
(e) Produce plots for both the filtered and unfiltered Power Spectral Density with respect to frequencies
(f) Plot the recovered time domain signal and explain this filtering procedure in your own words.
Get your college paper done by experts
Do my question How much will it cost?Place an order in 3 easy steps. Takes less than 5 mins.
Leave a Reply
Want to join the discussion?Feel free to contribute!