67% found this document useful (3 votes)
2K views4 pages

Elementary Signal Generation in MATLAB

The document describes an experiment to generate standard discrete time signals including unit impulse, unit step, unit ramp, sinusoidal, and exponential signals. It provides the definitions and equations for each signal type. The algorithm involves defining the length of the signal, generating each signal based on its definition, and plotting the waveforms using MATLAB code. The result is that the code successfully generates and plots the waveforms of the five elementary discrete time signals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
2K views4 pages

Elementary Signal Generation in MATLAB

The document describes an experiment to generate standard discrete time signals including unit impulse, unit step, unit ramp, sinusoidal, and exponential signals. It provides the definitions and equations for each signal type. The algorithm involves defining the length of the signal, generating each signal based on its definition, and plotting the waveforms using MATLAB code. The result is that the code successfully generates and plots the waveforms of the five elementary discrete time signals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT NO.

2
DATE:17-06-15

ELEMENTARY SIGNAL GENERATION

AIM:
To generate the standard discrete time signal
a. Unit Impulse
b. Unit Step Signal
c. Unit Ramp Signal
d. Sinusoidal signal
e. Exponential signal

THEORY:
Signals that are discrete in time but continuous in amplitude are referred to as discrete-time
signals. Some discrete time signals that we encounter frequently are,
1. Unit Impulse Sequence
The unit impulse sequence is defined by
[n] = 1, n = 0,
0, n 0.
2. Unit Step Sequence
The unit step sequence is one that has an amplitude of zero for negative indices
and an amplitude of one for non-negative indices.
u[n] = 1, n 0,
0, n0.
3. Unit Ramp Sequence
The unit ramp sequence r[n]=n u[n] is defined by
r[n] = n, n 0,
0, n < 0.
4. Sinusoidal Signal
The sinusoidal signal is defined by y[n] = Asin(n).
5. Exponential Signal
The exponential signal is defined by x[n] = = A n, - x .

12

ALGORITHM:
Step1: Start
Step 2: Define the length of impulse sequence.
Step 3: Generate unit impulse function by defining 1 at n=0 location and 0 at n 0
Step 4: Generate unit step function by defining 1 at n0 location and 0 at n<0
Step 5: Generate unit ramp function by defining n at n0 location and 0 at n<0
Step 6: Generate exponential function by defining A.^n or exp function
Step 7: Define period N
Step 8: Find frequency f= 1/N
Step 9: Generate sinusoidal signal using sine function
Step 10: Plot the waveforms using stem command
Step 11: Stop

13

PROGRAM:
% Elementary signal generation
n=-10:10;
x1=1;
x2=0;
% unit impulse
x=x1.*(n==0)+x2.*(n~=0);
subplot(3,2,1)
stem(n,x);
title('impulse');
xlabel('time');
ylabel('amplitude');

%to plot discrete signals

% unit step
y=x1.*(n>0)+x2.*(n~=0);
subplot(3,2,2)
stem(n,y);
title('unit step');
xlabel('time');
ylabel('amplitude');
% unit ramp
z=n.*(n>=0)+x2.*(n<0);
subplot(3,2,3)
stem(n,z);
title('ramp');
xlabel('time');
ylabel('amplitude');
% exponential
y=exp(n);
subplot(3,2,4)
stem(n,y);
title('exponential');
xlabel('time');
ylabel('amplitude');
% sinusoidal
N=10;
f=1/N;
s=sin(2*pi*f*n);
subplot(3,2,5)
stem(n,s);
title('sinusoidal');
xlabel('time');
ylabel('amplitude');
axis([-10 10 -1.5 1.5])

14

RESULT:
Generated the elementary discrete time signal and plotted the waveforms

15

You might also like