Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Unit Sample Sequence:

General Expression:
(n) = 1 , n=0
0, n0

In MATLAB:
Function[x,n]=impseq(n0,n1,n2)
n0=0;
n1=-2;
n2=10;
n=n1:n2;
x=1*[(n-n0==0)];
Stem (n,x)
ans = 0

Graph:

Unit Step Sequence:


General Expression:
U (n-n0)=

nn0

n<n0

In MATLAB:
Function[x,n]=stepseq(n0,n1,n2)
n0=0;
n1=-3;
n2=3;
n=n1:n2;
x=1*[(n-n0>=0)];
stem(n,x)
ans =0
Graph:

Real valued exponential sequence:


General expression:
X (n) =an

n where a R

In MATLAB:
n=0:10;
x=(0.9).^n;
plot(n,x)

Graph:

Complex Valued Exponential Sequence:


General Expression:

X (n) =e (+i0) n
In MATLAB:
n=0:10;
x=exp((2+3i)*n);
y=real(x);

z=imag(x);
plot(n,z)
hold on
plot(n,y)

Graph:

Sinusoidal Sequence:
General Expression:
X (n) =A cos (0n+)

In MATLAB:
n=-pi: 0.1: pi;
Plot (n, cos (n))

Random Sequence:
General expression:
Rand (1, n) or randn(1,n)
In MATLAB:
rand(1,25)
ans =
Columns 1 through 9
0.9501 0.2311 0.6068 0.4860 0.8913 0.7621 0.4565 0.0185 0.8214
Columns 10 through 18
0.4447 0.6154 0.7919 0.9218 0.7382 0.1763 0.4057 0.9355 0.9169
Columns 19 through 25
0.4103 0.8936 0.0579 0.3529 0.8132 0.0099 0.1389

randn(1,25)
ans =
Columns 1 through 9
-0.4326 -1.6656 0.1253 0.2877 -1.1465 1.1909 1.1892 -0.0376
0.3273
Columns 10 through 18
0.1746 -0.1867 0.7258 -0.5883 2.1832 -0.1364 0.1139 1.0668 0.0593
Columns 19 through 25
-0.0956 -0.8323 0.2944 -1.3362 0.7143 1.6236 -0.69

Periodic Sequence:
General expression:
X (n) =x (n+N)

In MATLAB:
n=0:20;
x=n+n
x =Columns 1 through 15
0

8 10 12 14 16 18 20 22 24 26 28

Columns 16 through 21
30 32 34 36 38 40

You might also like