You are on page 1of 4

NAME:G.TEJA ID.

NO:R170267 CLASS:T-03

TRIANGLE USING THE RAMP


FUNCTION
clc;
close all;
clear all;
t=-3:0.01:7
a=(5/4)*(t+3).*(t>=-3);
b=(7.2/4)*(t-0).*(t>=0);
y=(a-b);
subplot(3,2,1)
plot(t,y,'r');
xlabel('time');
ylabel('amplitude');
title('using ramp');
grid;
subplot(3,2,2);
plot(t-3,y,'b');
xlabel('time');
ylabel('amplitude');
title('left shift');
grid;
subplot(3,2,3);
plot(t+3,y,'b');
xlabel('time');
ylabel('amplitude');
title('right shift');
grid;
NAME:G.TEJA ID.NO:R170267 CLASS:T-03

RECTANGLE
clc;
close all;
clear all;
t=-20:0.01:10;
y=(t>=-10&t<=7);

subplot(2,2,1);
plot(t,4*y,'b');
xlabel('time')
ylabel('amplitude')
title('rectangle')
NAME:G.TEJA ID.NO:R170267 CLASS:T-03

subplot(2,2,2)
plot(t-3,4*y,'b')
xlabel('time')
ylabel('amplitude')
title('left shift')

subplot(2,2,3)
plot(t+3,4*y,'b')
xlabel('time')
ylabel('amplitude')
title('right shift')
NAME:G.TEJA ID.NO:R170267 CLASS:T-03

You might also like