Digital Signal Processing Lab 2

2
Kulliyyah of Engineering, IIUM Department of Electrical and Electronics Engineering Digital Signal Processing Lab Semester II, Due Date: March 12, 2014 Lab 2. Random and Deterministic Signals Introduction: In this lab session, we will familiarize ourselves with basics of MATLAB. We will write MATLAB programs to generate deterministic and random signals. We will also write programs to plot various graphs that will illustrate Fourier series theory. Procedure: 1. To run MATLAB go to Start >> Programs >> MATLAB. Click the left button of the mouse on icon MATLAB. 2. Create a directory called DSP lab 2. Make this directory the current Directory of MATLAB. To perform this step click on the icon and browse to the DSP lab 2 directory. Save all your MATLAB files in this directory. I. Deterministic Signals I.I Sinusoidal Signals 3. Write the following program to plot a sine wave. Save this program and name it as sine_wave.m. Run this program. ( Hint: Use sin MATLAB command.) Q1) Determine the amplitude, phase, period, sampling frequency, circular frequency (Hz), and angular frequency (rad/sec) of the sine wave. I.II Fourier Series Fourier series theory states that a periodic wave can be represented as a summation of sinusoidal waves with different frequencies, amplitudes and phase values. 4. Write a program that plots the signal s(t). Name this program as sine_wave_1.m. = = N n n nt t s 1 ) 2 sin( ) ( π where n = 1, 3, 5, 7, 9 and N = 9 or

description

Assignment 2

Transcript of Digital Signal Processing Lab 2

Page 1: Digital Signal Processing Lab 2

Kulliyyah of Engineering, IIUM

Department of Electrical and Electronics Engineering

Digital Signal Processing Lab

Semester II, Due Date: March 12, 2014

Lab 2. Random and Deterministic Signals

Introduction:

In this lab session, we will familiarize ourselves with basics of MATLAB. We will write

MATLAB programs to generate deterministic and random signals. We will also write

programs to plot various graphs that will illustrate Fourier series theory.

Procedure:

1. To run MATLAB go to Start >> Programs >> MATLAB. Click the left button of

the mouse on icon MATLAB.

2. Create a directory called DSP lab 2. Make this directory the current Directory of

MATLAB. To perform this step click on the icon and browse to the DSP lab 2

directory. Save all your MATLAB files in this directory.

I. Deterministic Signals

I.I Sinusoidal Signals

3. Write the following program to plot a sine wave. Save this program and name it as

sine_wave.m. Run this program.

( Hint: Use sin MATLAB command.)

Q1) Determine the amplitude, phase, period, sampling frequency, circular frequency

(Hz), and angular frequency (rad/sec) of the sine wave.

I.II Fourier Series

Fourier series theory states that a periodic wave can be represented as a summation of

sinusoidal waves with different frequencies, amplitudes and phase values.

4. Write a program that plots the signal s(t). Name this program as sine_wave_1.m.

∑=

=

N

n n

ntts

1

)2sin()(

π

where n = 1, 3, 5, 7, 9 and N = 9 or

Page 2: Digital Signal Processing Lab 2

9

)18sin(

7

)14sin(

5

)10sin(

3

)6sin()2sin()(

tttttts

πππππ ++++=

5. Write a program that plots the signal s(t) in step 2 but with N = 100. Name this

program as sine_wave_2.m

Q2) What do you conclude from steps 4 & 5?

I.III Other Signals

6. Plot the discrete signal x = [0, 1, 3, 1, -2, 0, 2, 0, 1, 4]. Name this program as

Discrete_1.m.

(Hint: Use stem MATLAB command)

7. Write the following program to plot a discrete-time square wave. Name this program

as square_wave.m.

(Hint: Use square MATLAB command)

Q3) Determine the sampling frequency, circular frequency (Hz), relative frequency,

period, and duty cycle of the square wave signal.

8. Write a program that plots a discrete time sawtooth signal. Name this program as

sawtooth_wave.m.

(Hint: use sawtooth MATLAB command)

II. Random Signals

9. A normally distributed random signal of length N can be generated using the

MATLAB command randn(1,N). Write the following MATLAB program that

generates a normally distributed random signal of length 100 samples. Name this

program as randn_wave.m.

10. Write the following Matlab program to generate noisy sinusoidal wave. Name this

program as noisy_sine_wave.m.