EEC 652 DSP Lab

Preview:

DESCRIPTION

UPTU/GBTU/MMTU Electronics and Communication 3rd year DSP Lab File, MATLAB

Citation preview

INDEX

S.NO

1.

2.

3.

4.

5.

6.

7.

8.

EXPERIMENT NAME

To plot the square waveform of 40% duty cycle.

To plot the waveform of functions x(t) = (sin t)^2 + (cos t)^3 and y(t) = t ^ 2*exp(t).

To draw the response of unit step,unit impulse and unit ramp function.

To draw the waveform of sine, cosine and exponential function.

To plot the underdamped waveform of sine and cosine functions.

To find the convolution of two functions h[n]=[1 2 1] and x[n]=[1 3 2 ].

To find the co-orelation between the functions x1[n]=[1 2 3] and x2[n]=[1 2 3 4].

To evaluate the 4-point dft and idft of the function x[n]=1 for 0<=n<=3, otherwise 0.

DATE SIGNATURE

Program-1

Object- To plot the square waveform of 40% duty cycle.

Program-

t=0:pi/4:2*pi;

y=square(t,40)

plot(t,y)

Output-

0 1 2 3 4 5 6 7-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Program-2

Object- To plot the waveform of functions x(t) = (sin t)^2 + (cos t)^3 and

y(t) = t ^ 2*exp(t).

Program-

t=pi:pi/4:2*pi

x= (sin(t)).^2+(cos(t)).^3

y=(t.^2).*exp(t)

subplot(1,2,1)

plot(t,x)

subplot(1,2,2)

plot(t,y)

Output-

3 4 5 6 7-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

3 4 5 6 70

0.5

1

1.5

2

2.5x 10

4

Program-3

Object- To draw the waveforms of unit step, unit impulse and unit ramp functions.

Program-

x=0:4:16

y1=[1;zeros(99,1)]

y2=[1;ones(99,1)]

y3=(x)

subplot(1,3,1)

plot(y1)

subplot(1,3,2)

plot(y2)

subplot(1,3,3)

plot(y3)

Output-

0 50 1000

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 50 1000

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

0 50

2

4

6

8

10

12

14

16

Program-4

Object- To draw the waveform of sine, cosine and exponential functions.

Program-

x=0:pi/10:2*pi;

y=sin(x)

z=cos(x)

u=exp(x)

subplot(1,3,1)

plot(x,y)

subplot(1,3,2)

plot(x,z)

subplot(1,3,3)

plot(x,u)

Output-

0 5 10-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

0 5 10-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

0 5 100

100

200

300

400

500

600

Program-5

Object- To plot the underdamped waveforms of sine and cosine functions.

Program-

t=linspace(-10,10)

x=(sin(pi*t))./(pi*t)

y=(cos(pi*t))./(pi*t)

subplot(1,2,1)

plot(t,x)

subplot(1,2,2)

plot(t,y)

Output-

-10 -5 0 5 10-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

-10 -5 0 5 10-3

-2

-1

0

1

2

3

Program-6

Object- To find the convolution of two functions h[n]=[1 2 1] and x[n]=[1 3 2 ].

Program-

n=-1,1

h=[1 2 1]

x=[1 3 2]

y=conv(h,x)

stem(y)

Output-

1 1.5 2 2.5 3 3.5 4 4.5 50

1

2

3

4

5

6

7

8

9

Program-7

Object- To find the co-orelation between the functions x1[n]=[1 2 3] and

x2[n]=[1 2 3 4].

Program -

x1=[1 2 3]

x2=[1 2 3 4]

y=xcorr(x1,x2)

stem(y)

Output -

1 2 3 4 5 6 70

2

4

6

8

10

12

14

16

18

20

Program-8 Object - To evaluate the 4-point dft and idft of the function x[n]=1 for 0<=n<=3

otherwise 0.

Program -

For dft-

x=[ones(1,4) zeros(1,6)]

y=fft(x,4)

stem(y)

for idft-

x=[4 0 0 0]

y=ifft(x,4)

stem(y)

Output of dft-

1 1.5 2 2.5 3 3.5 40

0.5

1

1.5

2

2.5

3

3.5

4

Output of idft-

1 1.5 2 2.5 3 3.5 40

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Recommended