How do I write code to plot ramp function? Is there any command for ramp?

153 次查看(过去 30 天)
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.

采纳的回答

the cyclist
the cyclist 2015-3-26
There is no ramp function in MATLAB, but it could easily be coded as
function r = ramp(x)
r = max(0,x)
  7 个评论
the cyclist
the cyclist 2020-8-15
Take a look at the MATLAB Plot Gallery for ideas (and code) on how to plot.
If that doesn't help, please use more than 8 words to fully describe what you are trying to do, so that people don't waste time guessing at what you want.

请先登录,再进行评论。

更多回答(1 个)

ismael rashid
ismael rashid 2019-10-19
clc
clear all
signal_start = input(' signal start value : ');
signal_end = input(' signal end value : ');
ramp_value = input(' ramp : ');
a = [ signal_start:signal_end];
b =mod(a,ramp_value);
plot(a,b)
% hope it helps you

类别

Help CenterFile Exchange 中查找有关 Antennas, Microphones, and Sonar Transducers 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by