Digital Signal Processing Lab # 1: Basic Signal Characteristics Prepared by Md. Ibrahim Khalil

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Digital Signal Processing Lab # 1

Basic Signal Characteristics


Prepared by
Md. Ibrahim Khalil

Trigonometric Signals
Sin (x)
clear all
close all
clc
t=0:0.001:0.02;
f=50;
y=sin (2*pi*f*t);

plot (t,y)

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

0.002

0.004

0.006

0.008

0.01

0.012

0.014

0.016

0.018

0.02

Trigonometric Signals
Sin(x)
clear all
close all
clc
t=0:0.001:0.02;
f=50;
y=sin (2*pi*f*t);

plot (t,y,'o')

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

0.002

0.004

0.006

0.008

0.01

0.012

0.014

0.016

0.018

0.02

Trigonometric Signals
clear all
close all
clc
t=0:0.001:0.02;
f=50;
y=sin (2*pi*f*t);

stem (t,y)

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1

0.002

0.004

0.006

0.008

0.01

0.012

0.014

0.016

0.018

0.02

clear all;
close all;
clc; clf;
t=0:0.001:0.02;
f=50;
y=sin (2*pi*f*t);

axis([0,6,-1,1]);

subplot (2,2,1)
plot (t,y)
xlabel('time');
ylabel('amplitude');
title('sinusoid signal');

subplot (2,2,2)
plot (t,y,'o')
xlabel('time');
ylabel('amplitude');
title('sinusoid signal');
subplot (2,2,3)

stem (t,y)
xlabel('time');
ylabel('amplitude');
title('sinusoid signal');
subplot (2,2,4)

stem (t,y,'*')
xlabel('time');
ylabel('amplitude');
title('sinusoid signal');

sinusoid signal

0.5

0.5
amplitude

amplitude

sinusoid signal

0
-0.5

-0.5

0.005

0.01 0.015
time
sinusoid signal

-1

0.02

0.5

0.5
amplitude

amplitude

-1

0
-0.5
-1

0.005

0.01 0.015
time
sinusoid signal

0.02

0
-0.5

0.005

0.01
time

0.015

0.02

-1

0.005

0.01
time

0.015

0.02

Impulse Function
Impulse Response
1
0.9
0.8
0.7

Amplitude

clc;
clear all;
close all;
N=input('Number of
Samples');
n=-N:1:N
x=[zeros(1,N) 1 zeros(1,N)]
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Impulse Response');

0.6
0.5
0.4
0.3
0.2
0.1
0
-5

-4

-3

-2

-1

0
Time

Unit Step
clc;
clear all;
close all;
N=input('Number of Samples = ');
n=-N:1:N
x=[zeros(1,N) 1 ones(1,N)]
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Unit Step Response');

Unit Step Response


1

0.9
0.8

Amplitude

0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-10

-8

-6

-4

-2

0
Time

10

Unit Ramp Signal


Unit Ramp Response
10
8
6
4

Amplitude

clc;
clear all;
close all;
disp('UNUT RAMP SIGNAL');
N=input('Number of Samples = ');
a=input('Amplitude = ')
n=-N:1:N
x=a*n
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Unit Ramp Response');

2
0
-2
-4
-6
-8
-10
-10

-8

-6

-4

-2

0
Time

10

Exponential Decay
Exponential Decaying Signal Response
1
0.9
0.8
0.7

Amplitude

clc;
clear all;
close all;
disp('EXPONENTIAL DECAYING
SIGNAL');
N=input('Number of Samples = ');
a=0.5
n=0:.1:N
x=a.^n
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Exponential Decaying Signal
Response');

0.6
0.5
0.4
0.3
0.2
0.1
0

5
Time

10

Exponential Grow
clc;
clear all;
close all;
disp('EXPONENTIAL GROWING SIGNAL');
N=input('Number of Samples = ');
a=0.5
n=0:.1:N
x=a.^-n
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Exponential Growing Signal Response');

Exponential Growing Signal Response

1200

1000

Amplitude

800

600

400

200

5
Time

10

You might also like