0% found this document useful (0 votes)
35 views

Basic Signals: Program

This document defines and plots six basic signal types: a sinusoidal wave, square wave, sawtooth wave, unit impulse signal, unit step signal, and unit ramp signal. It generates these signals using Matlab functions like sin, square, and sawtooth. The signals are plotted across 30 time units in six subplots with labeled axes to show their different waveform patterns over time.

Uploaded by

Humayun Ahsan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Basic Signals: Program

This document defines and plots six basic signal types: a sinusoidal wave, square wave, sawtooth wave, unit impulse signal, unit step signal, and unit ramp signal. It generates these signals using Matlab functions like sin, square, and sawtooth. The signals are plotted across 30 time units in six subplots with labeled axes to show their different waveform patterns over time.

Uploaded by

Humayun Ahsan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Basic Signals

Program:

t=0:0.01:30;
t1=0:0.8:40;
a=2;
y1=a*sin(t); %sine wave
y2=a*square(t,50); %Square wave
y3=a*sawtooth(t); %saw tooth wave
y4=[1;zeros(99,1)]; %Unit Impulse Signal
y5=ones(30,1); %Unit Step signal
y6=t1; %unit ramp signal

% ***** Sinusoidal Signal *****

subplot(3,2,1);
plot(t,y1)
title('Sinusoidal Waveform')
xlabel('Time Index')
ylabel('Amplitude')

% ***** Square Signal *****
subplot(3,2,2);
plot(t,y2)
title('Square waveform')
xlabel('Time Index')
ylabel('Amplitude')

% ***** Sawtooth Signal *****
subplot(3,2,3);
plot(t,y3)
title('Sawtooth waveform')
xlabel('Time Index')
ylabel('Amplitude')

% ***** Unit Impulse Signal *****
subplot(3,2,4);
stem(y4)
title('Unit Impulse Signal')
xlabel('Time Index')
ylabel('Amplitude')

% ***** Unit Step Signal *****
subplot(3,2,5);
stem(y5)
title('Unit Step Signal')
xlabel('Time Index')
ylabel('Amplitude')



***** Unit Ramp Signal *****
subplot(3,2,6);
stem(y6)
title('Unit Ramp Signal')
xlabel('Time Index')
ylabel('Amplitude')

Results: Plots on the Matlab are shown below:


0 5 10
-5
0
5
Sinusoidal Waveform
Time Index
A
m
p
l
i
t
u
d
e
0 5 10
-5
0
5
Square waveform
Time Index
A
m
p
l
i
t
u
d
e
0 5 10
-5
0
5
Sawtooth waveform
Time Index
A
m
p
l
i
t
u
d
e
0 50 100
0
0.5
1
Unit Impulse Signal
Time Index
A
m
p
l
i
t
u
d
e
0 10 20 30
0
0.5
1
Unit Step Signal
Time Index
A
m
p
l
i
t
u
d
e
0 20 40 60
0
20
40
Unit Ramp Signal
Time Index
A
m
p
l
i
t
u
d
e

You might also like