just plotting a 1 periodic function

1 vue (au cours des 30 derniers jours)
li
li le 31 Mar 2011
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

Réponse acceptée

Andrew Newell
Andrew Newell le 31 Mar 2011
function piecewise=piecew(x)
z = mod(x,2)-1;
piecewise=abs(1-abs(z)).*(abs(z)<1);
end
  1 commentaire
li
li le 1 Avr 2011
thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Elementary Math dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by