MATLAB code for discrete RAMP Function
MATLAB CODE
clc; clear all; close all;
n1 = -3;
n2 = 3;
no = -1; %+ve-->Lag
and -ve-->Lead
n = n1:n2;
N = length(n);
x = [(n-no)>=0];
R = 0;
for
j = 1:N
if x(j) == 1
R = R+1;
my_ramp(j) = R;
else
my_ramp(j) = 0;
end
end
figure(6)
stem(n,my_ramp)
title('unit
ramp function')
Join us on Facebook Group:
https://www.facebook.com/groups/matlabcodes
No comments