You are on page 1of 2

Signal and Systems Lab Session 03

NED University of Engineering and Technology Department of Electrical Engineering

Object:
To study different types of signal using MATLAB

Theory:
Singularity functions?
Elementary signals?

Define:
1. Dirac delta function:
2. Unit Step Sequence:
3. Ramp Sequence:
4. Sinc Function:
5. Rect Function:
6.Signum Function:
6. Square Wave and Saw-tooth Wave:

Generating Some Common Types of Signals by MATLAB:


For unit step:
x=(ones(size(n))).*(n>=0)
Note: size(n) returns dimension and number of elements in the array

For ramp:
x=n.*(n>=0)

For exponential:
x=(ones(size(n))).*(n>=0) %unit step
y=((0.5).^n).*x
stem(n,y)

For Rectangle:
t=-1:0.001:1;
y=rectpuls(t);
plot (t,y);

Triangle:
t=-1:0.001:1;
y=tripuls(t);
Signal and Systems Lab Session 03
NED University of Engineering and Technology Department of Electrical Engineering

plot (t,y);

Sawtooth:
fs = 10000;
t = 0:1/fs:1.5;
x = sawtooth(2*pi*50*t);
plot(t,x), axis([0 0.2 -1 1]);

Square wave:
t=0:0.01:20;
y=square(t);
plot(t,y)

Sinc function:
t = -5:0.1:5;
y = sinc(t);
plot(t,y)

Post Lab Exercise(s)


Task 1:
Plot the signals in continuous/discrete time domain

Task 2:
For given Matlab Code generate output graph and comment on the output.

a)
n=-10:10;
ramp=n.*(n>=0);
stem(n,ramp, 'filled');

b)
n=-20:0.25:20;
x=sign(n);
stem(n,x, 'filled');

c)
t=-4:0.01:4;
y=1*rectpuls(t,1);
plot(t,y ,'red','linewidth')

You might also like