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