creating a piecewise graph

조회 수: 1 (최근 30일)
Noah
Noah 2022년 9월 13일
답변: Sam Chak 2022년 9월 13일
For an assignment, I need to create a piecewise graph using the Heaviside function, but I have an equation 15 + 2*(x-1), x>=2, for a data set of 0:0.1:5. I am not sure how to input it using the Heaviside function.

채택된 답변

Sam Chak
Sam Chak 2022년 9월 13일
@Noah, you can probably test out the code, if this is the desired output:
x = 0:1e-5:5;
y = (15 + 2*(x - 1)).*heaviside(x - 2);
plot(x, y), grid on, ylim([-5 25]), xlabel('x')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by