How do you solve a periodic function with more then 1 period?

How do you solve a periodic function with more than 1 period? I have a function with one period that has the code
f=@(x)2*mod(x,1)-1
This is for 1 period how do I adjust this to have 5 periods.
[merged from duplicate question]
Let f1(x) = 2x−1 for x ∈ [−1,+1) where this function is also extended periodically to the entire line (where each period is 2 units long). Plot it over 5 complete periods. Then define it as an anonymous function

Answers (1)

See if this does what you want:
f=@(x)2*mod(x,1)-1
x = linspace(0, 5);
figure(1)
plot(x, f(x))
grid

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 3 Feb 2016

Edited:

on 3 Feb 2016

Community Treasure Hunt

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

Start Hunting!