help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can Not Reproduce Plot


From: Thomas D. Dean
Subject: Can Not Reproduce Plot
Date: Fri, 10 Jun 2016 12:30:36 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

> gnuplot --version
gnuplot 5.1 patchlevel 0

octave:491> ver
----------------------------------------------------------------------
GNU Octave Version: 4.1.0+
GNU Octave License: GNU General Public License
Operating System: Linux 3.13.0-86-generic #131-Ubuntu SMP Thu May 12 23:33:13 UTC 2016 x86_64
...

From the doc, 28.5 Polynomial Interpolation, shows a plot of points plus two lines. I can not reproduce this. The 'dots' are connected with lines so I get a scribble across the plot of the two lines.

Is this a gnuplot problem?

x = 2 * pi * rand (1, 200);
y = sin (x) + sin (2 * x) + 0.2 * randn (size (x));
## Uniform breaks
breaks = linspace (0, 2 * pi, 41); % 41 breaks, 40 pieces
pp1 = splinefit (x, y, breaks);
## Breaks interpolated from data
pp2 = splinefit (x, y, 10); % 11 breaks, 10 pieces
## Plot
xx = linspace (0, 2 * pi, 400);
y1 = ppval (pp1, xx);
y2 = ppval (pp2, xx);
plot (x, y, ".", xx, [y1; y2])
axis tight
ylim auto
legend ({"data", "41 breaks, 40 pieces", "11 breaks, 10 pieces"})

How do I plot points?

Tom Dean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]