Hi, I want my triangle wave to start at the origin, how can I do that?
This is my code:
t = linspace(0,6.840,10000);
x = 19.6.*sawtooth(t,0.5);
plot(t,x)
grid on
xticks([0 1 2 3 4 5 6 6.840])
yticks([-19.6 -15:5:15 19.6])

 채택된 답변

DGM
DGM 2022년 2월 8일

0 개 추천

You can just offset t
t = linspace(0,6.840,10000);
x = 19.6.*sawtooth(t+pi/2,0.5);
plot(t,x)
grid on
xticks([0 1 2 3 4 5 6 6.840])
yticks([-19.6 -15:5:15 19.6])

추가 답변 (1개)

Walter Roberson
Walter Roberson 2022년 2월 8일

0 개 추천

t = linspace(0,6.840,10000);
x = 19.6.*(1 + sawtooth(t,0.5));
plot(t,x)
grid on
xticks([0 1 2 3 4 5 6 6.840])
yticks([-19.6 -15:5:15 19.6])

카테고리

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

질문:

2022년 2월 8일

댓글:

2022년 2월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by