trying to plot a more complicated step function

I need an equation for a function y(t) where; y(t) = 0 from 0 < t < 1.25; y(t) = -0.18 from 1.25 < t < 2.5; y(t) = 0 from 2.5 < t < 7.5;
It's not necessarily a matlab question but I can't figure out how to plot this step function in matlab. One equation would be helpful as opposed to a piecewise function.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 23일
편집: Azzi Abdelmalek 2016년 4월 23일

0 개 추천

ts=0.01
t1=0:ts:1.25-ts
t2=1.25:ts:2.5-ts
t3=2.5:ts:7.5
t=[t1 t2 t3]
y=[t1*0 -0.18*ones(size(t2)) 0*t3]
plot(t,y)
or
t=0:ts:7.5
y=-0.18*(heaviside(t-2.5)-heaviside(t-1.5))
plot(t,y)

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

태그

질문:

2016년 4월 23일

편집:

2016년 4월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by