Professional Documents
Culture Documents
TUSHAR BALAJI
3122 21 3002 114
GENERATION OF DT SEQUENCES
DATE:02/03/2023
EX.NO : 1
Aim:
To write a MATLAB Program to generate the Basic Discrete Time sequences and Random
Sequences
1.Unit Impulse Signal
2.Unit Step Signal
3.Ramp Signal
4.Exponential signal
5.Sinusoidal sequence
6.Cosine wave
7.Sinc Signal
8.Rectangular Pulse
9.Triangular Pulse
10.Random Signal
Software Used:
MATLAB INTERPRETER – R2022 b VERSION
Description:
Elementary signals are those that are basically used to analyse basic systems.
Impulse signal , Unit step signal , sinusoidal signal , exponential signal and ramp signal are some of
the elementary signals. Random Signals are those which are not precisely predictable ; that is , given
the past history of a signal and the amplitude values it has taken on , it is not possible to precisely
predict what particular value it will take on at certain instants in the future.
MATLAB Program:
clear;
clc;
close all;
S.P.TUSHAR BALAJI
3122 21 3002 114
Simulated Graph:
Simulated Graph:
3.Ramp sequence
Code:
r_t= (n>=0).*n;
subplot(3,1,3)
stem(n,r_t);
xlabel('time');
ylabel('amplitude');
title('Unit ramp sequence');
S.P.TUSHAR BALAJI
3122 21 3002 114
Simulated Graph:
4.Exponential Signals
4.1.Exponential sequence: Case 1 : 0<a<1 a=0.5
Code:
n=-20:1:20;
A=0.95;
x=A.^n;
subplot(2,2,1);
stem(n,x);
xlabel('n');
ylabel('x(n)');
title('Exponenetial sequence 1');
Simulated Graph:
Simulated Graph:
Simulated Graph:
5.Sinusoidal signal
Code:
n=0:20;
N=20;
f=1/N;
x=sin(2*pi*f*n);
subplot(3,1,1);
stem(n,x);
xlabel('n');
ylabel('sin(n)');
title('sinusoidal sequence');
S.P.TUSHAR BALAJI
3122 21 3002 114
Simulated Graph:
6.Cosine Wave
Code:
n=0:20;
N=20;
f=1/N;
x=cos(2*pi*f*n);
subplot(1,1,1);
stem(n,x,'r');
xlabel('n');
ylabel('sin(n)');
title('cosinusoidal sequence');
Simulated Graph:
7.Sinc function
Code:
n=linspace(-8,8);
y=sinc(n);
subplot(3,1,3);
stem(n,y);
S.P.TUSHAR BALAJI
3122 21 3002 114
xlabel('n');
ylabel('sinc(n)');
title('sinc function');
Simulated Graph:
8.Rectangular pulse
Code:
n=-5:5;
rect_n = n>=-3 & n<=3;
subplot(2,1,1);
stem(n,rect_n,'r');
xlabel('n');
ylabel('rect(n)');
title('Unit rectangular sequence');
Simulated Graph:
9.Triangular pulse
Code:
clc;
close all;
clear;
N=20;
f=1/N;
t=-1:f:1;
x=tripuls(t)
stem(t,x);
xlabel('time');
ylabel('Amplitude');
title('Triangular pulse');
S.P.TUSHAR BALAJI
3122 21 3002 114
Simulated Graph:
Code:
N=10^8;
mu=3;
s=3;
rand(1,N);
rand(0,1);
x=sqrt(s)*randn(1,N)+mu;
subplot(2,1,2);
histogram(x);
xlabel('time');
ylabel('Amplitude');
title('Gaussian Variable function')
Simulated Graph:
Result:
Thus , the MATLAB Programs to generate the Basic and Random Discrete Time Sequences is
executed and the output is verified.