Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Get Rid of it

I've had task to do - to make an graphical interpretation of adding two functions together: sin(8x) and multiplied -sign(x) in Octave, as shown on image above. And I've done that, but I don't know how to get rid of these lines, which link up gaps between separated values (for example, -1 and 1). I don't want them to be seen especially in third graph.

To make helping me easier, I'm going to tell you what I did:

  1. I made linear series of numbers, from -100 to 99 (tempx).
  2. tempy = -sign(tempx)
  3. y1 = [tempy tempy tempy tempy] (this line is kinda funny, if you know Polish language)
  4. Creating y2 - sinus function
  5. y3 = y2 + y1
  6. Plotting, subplotting...
  7. Screenshot

Awaiting for instructions...

share|improve this question
up vote 0 down vote accepted

in default mode plot connects all the points with a line. with plot(y3,'.') you just plot the actual points itself. you can choose between different symbols to plot like '*', 'x' and more.

If you really need to connect the points, you can split the vector in different subvectors and plot them all separate.

t = [0:1:9];
x = [ones(1,5) -ones(1,5)];

axis([0 10, -2 2])
share|improve this answer
I've used solution with '.', but there were a single points with value of 0. So I've looked into my data series and then I've changed these points to -1. And it looks alright now. Your second tip seemed to me hard to adapt to my task. Anyway thanks for help and inspiration :) – Twórca Oct 26 '13 at 17:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.