MATLAB: How to write code to plot ramp function? Is there any command for ramp

ramp function discrete-time function

The discrete function I want to plot is g[n] = ramp[n + 2]− 2ramp[n]+ ramp[n − 2]
The interval is -5<=n<=10
Thanks in advance.

Best Answer

There is no ramp function in MATLAB, but it could easily be coded as
function r = ramp(x)
r = max(0,x)