12 views

Uploaded by sahar

Computer Assignment 1

save

- 28th Mathirang Mathibay Mechanics
- Fibonacci Search
- A Study of Various Projected Data Based Pattern Mining Algorithms
- 04pres
- books usa
- Waste Collection Vehicle Routing Problem Considering Similarity Pattern of Trashcan
- Block Art English IEEEXtreme 9
- Bankers Algorithm
- Digital Signal Processing with Applications
- Sequencing
- Computer EV 18Aug
- pect4.5
- c2
- Lecture 9 (Notes)
- Digital Signal Processing-chapter 16: MATLAB Programs
- Quasiconvex Functions and Nonlinear PDEs
- EC_Con-2.pdf
- Bruteforece2
- Problem Solving I
- Circulating Load Estimation in Closed Circuits - PPT
- Model Predictive Control of Van de Vusse Reactor
- 143 - 1 - Week 1- 1.6 - Adams Time-stepping Schemes (9-41)
- mid1key-s08
- Solution EOQ
- Fundamental Frequency Estimation Algorithms Presentation
- The Evolution of Forecasting
- Where to Study Maths UK
- XII Maths DPP (27) - Prev Chaps - Area Under Curves - LPP - Differential Equation
- unitplan
- MatVP2DEIT_Part9.pdf
- Simulating Control Systems with Simulink and MATLAB
- Introduction to MATLAB
- Control System Toolbox Release notes
- linear system analysis
- Nonlinear Dynamics I: Chaos.pdf
- Perspectives on System Identification
- Discrete-time signals and systems-chapter 2
- Linear Algebra and differential equation, by: Baker
- System Identification Theory for User
- A Brief Introduction to MATLAB
- Design Optimization of Mechanical Components
- Digital Signal Processing with Applications
- osciloscope tutorial
- Digital Signal Processing-chapter 16: MATLAB Programs

You are on page 1of 3

**Sharif University of Technology
**

Computer Engineering Department

DSP

Dr. Manzuri

Computer Assignment 1

Dear All,

This assignment is intended to make you familiar with MATLAB’s

DSP-related functions. Please e-mail a zip file including your M-

files and the word document to CEDSP901@gmail.com. The

subject of your mail and the name of your zip file should be

HW1_xxxxxxxx in which the 8-digit number is your student ID.

Note that all the curves should be automatically plotted and no one

will debug the code. Choose proper titles for your plots and

separate M-files for each problem. 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.

2

= cos (2n - 4uut)

x = cos(2n - 4uut) +u.S - cos(2n - 4uuut)

c) Use fft

1

function to compute and plot the magnitude of the DFT of the sequence x. Be

careful of the interval over which the output lies.

d) Apply fftshift function on the result and plot the output’s magnitude. Describe the

difference made.

e) What is the relationship between the computed DFT and the fourier transform of the

continuous-time signal? Plot the magnitude of the fourier transform of the continuous-

time signal as well.

f) Define a function

output_signal=FFT_LP (input_signal,cutoff_frequency,passband_gain)

that implements a discrete-time lowpass filter. The input and output signals are in time

domin and the cutoff frequency is over |u, n]. Use ifft to calculate the inverse fourier

transform (use the ‘symmetric’ option and explain what it does)

g) Apply this filter on the sequence x and try to diminish the higher frequency component

(4kHz). Plot the result in both time and frequency domains (use fftshift).

2. FIR Filtering

a) Define a vector b|n] as following:

b|n] =

1

4

1. Ideal Filtering

a) Define a vector for the time interval [0,2s] with 44100 points per second (the sampling

rate is 44.1kHz)

b) Generate the following vectors in the above-mentioned time interval and plot the results

over [0,5ms] using stem and xlim (samples of the continuous-time signal) :

m

1 ¸ n ¸ 4

that represents the impulse response of a moving average system. plot the magnitude and

phase of the fft of the sequence.

b) As you see the result does not look like the DTFT of the sequence. Try to somehow

modify the vector to increase the number of samples given by fft function to over 100.

Plot the magnitude and phase of the fft for the new sequence.

c) Use unwrap function and plot the phase again. Describe the difference made.

1

DTFT of a vector is a continuous function with a period of 2n . DFT of a vector gives a number of samples of the

DTFT equal to the length of the vector in the time domain and equally spaced along the interval [0, 2n]. Check out

MATLAB’s help for further information.

3

¸

y|n] - y|n -1] +y|n - 2] = x|n] + x|n - 1]

b) Now use impz and stepz functions to calculate and stem the impulse and step

responses.

c) Calculate and stem the output of the system for the following input sequences over

u ¸ n ¸ 1uu using filter function:

I) x

1

|n] = cos [

n

6

d) Now define the function

output_signal=moving_average(input_signal,M1,M2)

that implents a moving average filter with parameters M1 and M2 doing calculations in

the time domain (Adjust the output length properly).

e) Apply this function on the sequence x as defined in problem 1. Try to choose a proper set

of M1 and M2 so as to attenuate the higher frequency component. Plot the result in both

time and frequency (phase and magnitude) domains. Comment your choice of M1 and

M2 as well. What is the difference between the impulse response of the

moving_average filter and the FFT_LP filter in both time and frequency domains?

3. Z-Transform & Sampling

a) Calculate and stem the impulse response of a system defined by the following difference

equation for u n ¸ 1uu:

n¸

II) x

2

|n] = (-1)

n

d) Calculate and plot the magnitude of the DFT of the above sequences.

e) Downsample both sequences by 2 and plot the magnitude of the DFT for the resulting

signals. Also stem the output of the filter for the resulting input signals (Use

downsample).

f) Now Upsample both sequences (x

1

|n] and x

2

|n]) by 3 and plot the magnitude of the

DFT for the resulting signals. Stem the output of the filter for these input signals as well

(Use upsample).

g) Use zplane and freqz and plot the results (Magnitude and Phase). Referring to these

diagrams, discuss the system’s stability and the results you have observed in parts e and f.

- 28th Mathirang Mathibay MechanicsUploaded byBogus Account
- Fibonacci SearchUploaded byJeoff Libo-on
- A Study of Various Projected Data Based Pattern Mining AlgorithmsUploaded byInternational Journal for Scientific Research and Development - IJSRD
- 04presUploaded byRishi N Rishi N
- books usaUploaded byErika Almeida
- Waste Collection Vehicle Routing Problem Considering Similarity Pattern of TrashcanUploaded byMartin Legion
- Block Art English IEEEXtreme 9Uploaded byAlejandro Lopez
- Bankers AlgorithmUploaded bysiva231108
- Digital Signal Processing with ApplicationsUploaded bysahar
- SequencingUploaded bySundaramali Govindaswamy G
- Computer EV 18AugUploaded byVijesh
- pect4.5Uploaded bysnathick
- c2Uploaded byUpul Jayasinghe
- Lecture 9 (Notes)Uploaded byillustra7
- Digital Signal Processing-chapter 16: MATLAB ProgramsUploaded bysahar
- Quasiconvex Functions and Nonlinear PDEsUploaded byPham Duy Khanh
- EC_Con-2.pdfUploaded byKhushboo Tewari
- Bruteforece2Uploaded bypermanaksm
- Problem Solving IUploaded bycipta mandala putra
- Circulating Load Estimation in Closed Circuits - PPTUploaded byTomas Ttica Gaspar
- Model Predictive Control of Van de Vusse ReactorUploaded bySatyajeet Bhonsale
- 143 - 1 - Week 1- 1.6 - Adams Time-stepping Schemes (9-41)Uploaded byYeong Gyu Kim
- mid1key-s08Uploaded byBambang Satrio
- Solution EOQUploaded byNurdalilah Othman
- Fundamental Frequency Estimation Algorithms PresentationUploaded byLinh Nguyen
- The Evolution of ForecastingUploaded byCristian Valdez
- Where to Study Maths UKUploaded byMike Antony
- XII Maths DPP (27) - Prev Chaps - Area Under Curves - LPP - Differential EquationUploaded byNibha Pandey
- unitplanUploaded byapi-426109578
- MatVP2DEIT_Part9.pdfUploaded byTushar Kanti Bera

- Simulating Control Systems with Simulink and MATLABUploaded bysahar
- Introduction to MATLABUploaded bysahar
- Control System Toolbox Release notesUploaded bysahar
- linear system analysisUploaded bysahar
- Nonlinear Dynamics I: Chaos.pdfUploaded bysahar
- Perspectives on System IdentificationUploaded bysahar
- Discrete-time signals and systems-chapter 2Uploaded bysahar
- Linear Algebra and differential equation, by: BakerUploaded bysahar
- System Identification Theory for UserUploaded bysahar
- A Brief Introduction to MATLABUploaded bysahar
- Design Optimization of Mechanical ComponentsUploaded bysahar
- Digital Signal Processing with ApplicationsUploaded bysahar
- osciloscope tutorialUploaded bysahar
- Digital Signal Processing-chapter 16: MATLAB ProgramsUploaded bysahar