just plotting a 1 periodic function

조회 수: 11 (최근 30일)
li
li 2011년 3월 31일
I would like to plot a 1 periodic function and it could be piecewise linear. I have a function like below,it is a triangular function, I would like to extend the triangle with a period 1,how can I do it? thanks
function piecewise=piecew(x);
piecewise=abs(1-abs(x)).*(abs(x)<1);
end

채택된 답변

Andrew Newell
Andrew Newell 2011년 3월 31일
function piecewise=piecew(x)
z = mod(x,2)-1;
piecewise=abs(1-abs(z)).*(abs(z)<1);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by