1 Sharif University of Technology DSP Dr. Sameti Computer Assignment 1 Dear All, This assignment is intended to make you familiar with MATLABβs DSPrelated functions. Please E-mail a zip file including your M-files and the word document to [email protected] . The name of your zip file should be HW1_xxxxxxxx in which the 8-digit number is your student ID. Notice that all the curves should be automatically plotted and no one will debug the codes. Choose proper titles for your plots and use separate M-files for different problems. Try to make each part of the problem recognizable by commenting (e.g. %a, %b, etc.). The word document should just contain your answers to the explanatory questions presented in each problem. If you have any questions please contact me by email [email protected]. 2 1. Analysis of Periodic Signals in the Frequency Domain 1 a) Consider the signal π₯(π‘) = sin(2πππ‘ + π) + cos(2π4000π‘) , plot this signal for π = 10 and π π = 6 using the command plot. Generate a discrete time vector with length 100000 with time interval [0,10]π and assume the sampling rate of 10ππ»π§. b) Plot the phase and magnitude of the spectrum of the above mentioned signal using the function fft. c) Apply fftshift function on the result and plot the outputβs magnitude. Describe the difference made. d) Try to use three periods of the signal to determine and sketch the magnitude and phase of the spectrum. How and why these plots differ from the previous parts? e) Now define the function below to implement a discrete time lowpass filter Output = FFT_LP (input, cutoff_frequency, passband_gain) That implement a discrete time lowpass filter and cutoff frequency is over [0, π]. Use ifft with the βsymmetric' option for calculating the invers Fourier transform in the function, and explain what is does. f) Apply this filter on the signal x and try to diminish the higher frequency component (4 kHz). Plot the result in both time and frequency domains (use fftshift). 2. Z transform a) Consider the following difference equation for 0 β€ π < 300: π¦[π] β π¦ [π β 1] + 0.9 π¦[π β 2] = π₯[π] β π₯[π β 2] Calculate the impulse response of the above mentioned filter for 0 β€ π < 300 without using MATLABβs built in functions and display your impulse response using stem. b) Using impa and steps functions calculate the impulse and step response and display them in two separate figures. 3ππ 8 c) Calculate and show the output of the filter for input sequence π₯1[π] = sin ( 5ππ ) ππ£ππ 8 cos ( 0 β€ π < 300 using the filter function. d) Calculate and plot the magnitude of the DFT of the above sequence. + π )+ 16 3 e) Downsample and unsample x1[n] by the factor of 3 using downsample and unsample functions. Calculate and show the filter output for the two new signals. f) Utilize freqz and zplane commands in order to display the pole-zero diagram of the filter, then discuss whether the filter is stable or not. Also, try to explain the results obtained in parts (c) and (d) based on the diagram and your knowledge.
© Copyright 2026 Paperzz