How to make function f(x)=-x periodic of (2*pi) explicitly?

9 views (last 30 days)
Hi Folks,
I have a function f(x)=-x that starts from [-pi:pi] and I wanna repeat this function for a few periods of (2*pi) with the amplitude ranged between [pi to -pi].
I appreciate your response.

Accepted Answer

Roger Stafford
Roger Stafford on 28 Jun 2013
f(x) = mod(-x+pi,2*pi)-pi;
  2 Comments
Mohammed Sayan
Mohammed Sayan on 28 Jun 2013
Thanks,
but I want the lines f(x)=-x disconnected.
Is is possible?
Roger Stafford
Roger Stafford on 28 Jun 2013
Are you referring to doing a plot of this function? If you don't want a line connecting the points where a discontinuity occurs, you should use the '.' plotting option rather than '-'. Your plot will then be a series of dots. If you don't want dots, you will have to plot each 2*pi interval separately using the "hold on" instruction between the intervals.

Sign in to comment.

More Answers (0)

Categories

Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!