You are on page 1of 4

BASIC DISCRETE SIGNALS

UNIT STEP SEQUENCE

PROGRAM:

clc;
N = input('Enter the no.of samples=');
K = input('Enterthe shift value=');
a = [zeros(1,K),ones(1,N-K)];
n = 0:N-1;
stem(n,-a)

COMMAND:

Enter the no.of samples=8

Enterthe shift value=3

FIGURE:

-0.1

-0.2

-0.3

-0.4

-0.5

-0.6

-0.7

-0.8

-0.9

-1
0 1 2 3 4 5 6 7
RAMP SEQUENCE

PROGRAM:

clc;
N=input('Enter the no. of samples=');
n=0:1:N-1;
y=n;
stem(n-1,y)

COMMAND:

Enter the no. of samples=6

FIGURE:

4.5

3.5

2.5

1.5

0.5

0
-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4
COSINE SEQUENCE

PROGRAM:

clc;
N=input('Enter the no. of samples=');
A=input('Enter the amplitude=');
theta=input('Enter the phase difference=');
W=input('Enter the angular frequency=');
n=0:1:N;
y=[A*cos(W*n+theta)];
stem(n,y)

COMMAND

Enter the no. of samples=40

Enter the amplitude=03

Enter the phase difference=60

Enter the angular frequency=50

FIGURE:

-1

-2

-3
0 5 10 15 20 25 30 35 40
EXPONENTIAL SEQUENCE

PROGRAM:

clc;
N=input('Enter the value of N=');
C=input('Enter the value of C=');
A=input('Enter the value of A=');
n=0:0.2:N;
y=[C*(A.^n)];
stem(-n,-y)

COMMAND:

Enter the value of N= 6

Enter the value of C= 5

Enter the value of A= 3

FIGURE:

4000

3500

3000

2500

2000

1500

1000

500

0
-6 -5 -4 -3 -2 -1 0

You might also like