I'm looking to plot a rectangular pulse and triangula

조회 수: 8 (최근 30일)
DK
DK 2016년 9월 12일
댓글: michio 2016년 9월 14일
I'm looking to plot a unit step function from -2 to 2 and in between there is a unit ramp that goes from -2 to 1 and back to 2. I cannot figure out how to call the functions or plot them. I am just learning the program.

답변 (1개)

michio
michio 2016년 9월 14일
Have you looked at stairs function? For discrete data, stem function could be a choice too.
X = [0,1,2,3,4,5];
Y = [-2,1,2,-2,2];
stairs(X,Y)
ylim([-3,3])
For details and more examples, please execute
>> doc stairs
at your command window to see the documentation page.
  댓글 수: 2
DK
DK 2016년 9월 14일
I was trying to use the rectangular pulse and triangular pulse equation though.
michio
michio 2016년 9월 14일
Hmm, I must apologize that now I do see what you are trying to achieve here.
If you use Symbolic Math Toolbox, there's a function for rectangular/triangular pulse,
Once you define a function, fplot can be of help in plotting. See the examples in the above URL.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Pulse and Transition Metrics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by