Mercurial > octave-nkf
comparison scripts/general/interp1.m @ 19631:db92e7e28e1f
strip trailing whitespace from most source files
* NEWS, doc/interpreter/contributors.in, doc/interpreter/func.txi,
doc/interpreter/genpropdoc.m, doc/interpreter/octave_logo.eps,
doc/interpreter/plot.txi, doc/interpreter/stmt.txi,
examples/data/Makefile.am, libinterp/corefcn/data.cc,
libinterp/corefcn/debug.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/load-path.cc, libinterp/corefcn/pr-output.cc,
libinterp/corefcn/pt-jit.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/urlwrite.cc, libinterp/corefcn/variables.cc,
libinterp/octave-value/ov-classdef.cc,
libinterp/octave-value/ov-classdef.h, libinterp/octave.cc,
libinterp/parse-tree/lex.h, libinterp/parse-tree/oct-parse.in.yy,
libinterp/parse-tree/pt-classdef.h, liboctave/system/file-ops.cc,
liboctave/system/oct-env.cc, m4/acinclude.m4,
scripts/deprecated/finite.m, scripts/deprecated/fmod.m,
scripts/deprecated/fnmatch.m, scripts/deprecated/luinc.m,
scripts/deprecated/octave_tmp_file_name.m, scripts/deprecated/syl.m,
scripts/deprecated/usage.m, scripts/general/inputParser.m,
scripts/general/interp1.m, scripts/general/interp2.m,
scripts/general/interp3.m, scripts/general/isequal.m,
scripts/general/private/__isequal__.m, scripts/geometry/voronoi.m,
scripts/image/image.m, scripts/image/imshow.m,
scripts/image/ind2rgb.m, scripts/linear-algebra/bandwidth.m,
scripts/linear-algebra/isbanded.m, scripts/miscellaneous/bzip2.m,
scripts/miscellaneous/cast.m, scripts/miscellaneous/copyfile.m,
scripts/miscellaneous/delete.m, scripts/miscellaneous/fullfile.m,
scripts/miscellaneous/getappdata.m, scripts/miscellaneous/gunzip.m,
scripts/miscellaneous/isappdata.m, scripts/miscellaneous/ls.m,
scripts/miscellaneous/mex.m, scripts/miscellaneous/movefile.m,
scripts/miscellaneous/orderfields.m, scripts/miscellaneous/recycle.m,
scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/setfield.m,
scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m,
scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m,
scripts/miscellaneous/ver.m, scripts/miscellaneous/what.m,
scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m,
scripts/optimization/fminbnd.m, scripts/optimization/sqp.m,
scripts/path/private/getsavepath.m, scripts/path/savepath.m,
scripts/pkg/pkg.m, scripts/pkg/private/installed_packages.m,
scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m,
scripts/plot/draw/private/__quiver__.m,
scripts/plot/draw/private/__scatter__.m,
scripts/plot/draw/private/__stem__.m, scripts/plot/draw/surface.m,
scripts/plot/draw/surfnorm.m, scripts/plot/util/copyobj.m,
scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m,
scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m,
scripts/plot/util/private/__go_draw_axes__.m, scripts/set/setdiff.m,
scripts/set/union.m, scripts/signal/periodogram.m,
scripts/sparse/eigs.m, scripts/sparse/ilu.m, scripts/sparse/qmr.m,
scripts/sparse/sprand.m, scripts/sparse/sprandn.m,
scripts/specfun/beta.m, scripts/specfun/ellipke.m,
scripts/specfun/isprime.m, scripts/statistics/base/lscov.m,
scripts/testfun/__run_test_suite__.m, scripts/testfun/test.m:
Strip trailing whitespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:29:54 -0500 |
parents | 0e1f5a750d00 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19630:0e1f5a750d00 | 19631:db92e7e28e1f |
---|---|
100 ## yp = sin (2*pi*xp/5); | 100 ## yp = sin (2*pi*xp/5); |
101 ## lin = interp1 (xp, yp, xf); | 101 ## lin = interp1 (xp, yp, xf); |
102 ## near = interp1 (xp, yp, xf, "nearest"); | 102 ## near = interp1 (xp, yp, xf, "nearest"); |
103 ## pch = interp1 (xp, yp, xf, "pchip"); | 103 ## pch = interp1 (xp, yp, xf, "pchip"); |
104 ## spl = interp1 (xp, yp, xf, "spline"); | 104 ## spl = interp1 (xp, yp, xf, "spline"); |
105 ## plot (xf,yf,"r", xf,near,"g", xf,lin,"b", xf,pch,"c", xf,spl,"m", | 105 ## plot (xf,yf,"r", xf,near,"g", xf,lin,"b", xf,pch,"c", xf,spl,"m", |
106 ## xp,yp,"r*"); | 106 ## xp,yp,"r*"); |
107 ## legend ("original", "nearest", "linear", "pchip", "spline"); | 107 ## legend ("original", "nearest", "linear", "pchip", "spline"); |
108 ## @end group | 108 ## @end group |
109 ## @end example | 109 ## @end example |
110 ## | 110 ## |
195 y = y(p,:); | 195 y = y(p,:); |
196 endif | 196 endif |
197 | 197 |
198 if (any (strcmp (method, {"previous", "*previous", "next", "*next"}))) | 198 if (any (strcmp (method, {"previous", "*previous", "next", "*next"}))) |
199 rightcontinuous = NaN; # needed for these methods to work | 199 rightcontinuous = NaN; # needed for these methods to work |
200 endif | 200 endif |
201 | 201 |
202 if (isnan (rightcontinuous)) | 202 if (isnan (rightcontinuous)) |
203 ## If not specified, set the continuity condition | 203 ## If not specified, set the continuity condition |
204 if (x(end) < x(1)) | 204 if (x(end) < x(1)) |
205 rightcontinuous = false; | 205 rightcontinuous = false; |
220 y = flipud (y); | 220 y = flipud (y); |
221 method = "previous"; | 221 method = "previous"; |
222 elseif (strcmp (method, "*next")) | 222 elseif (strcmp (method, "*next")) |
223 x = flipud (x); | 223 x = flipud (x); |
224 y = flipud (y); | 224 y = flipud (y); |
225 method = "*previous"; | 225 method = "*previous"; |
226 endif | 226 endif |
227 | 227 |
228 starmethod = method(1) == "*"; | 228 starmethod = method(1) == "*"; |
229 | 229 |
230 if (starmethod) | 230 if (starmethod) |
541 %!assert (isempty (interp1 (xp,yp,[],style))) | 541 %!assert (isempty (interp1 (xp,yp,[],style))) |
542 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... | 542 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... |
543 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) | 543 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) |
544 ## This test is expected to fail, so commented out. | 544 ## This test is expected to fail, so commented out. |
545 ## "previous" and "next" options are not symmetric w.r.t to flipping xp,yp | 545 ## "previous" and "next" options are not symmetric w.r.t to flipping xp,yp |
546 #%!assert (interp1 (xp,yp,xi,style),... | 546 #%!assert (interp1 (xp,yp,xi,style),... |
547 #%! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) | 547 #%! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) |
548 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), | 548 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), |
549 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) | 549 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) |
550 %!error interp1 (1,1,1, style) | 550 %!error interp1 (1,1,1, style) |
551 %!assert (interp1 (xp,[yp',yp'],xi,style), | 551 %!assert (interp1 (xp,[yp',yp'],xi,style), |
558 %!assert (interp1 (xp',yp',xp,style), yp, 100*eps) | 558 %!assert (interp1 (xp',yp',xp,style), yp, 100*eps) |
559 %!assert (isempty (interp1 (xp',yp',[],style))) | 559 %!assert (isempty (interp1 (xp',yp',[],style))) |
560 %!assert (isempty (interp1 (xp,yp,[],style))) | 560 %!assert (isempty (interp1 (xp,yp,[],style))) |
561 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... | 561 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... |
562 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) | 562 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) |
563 # %!assert (interp1 (xp,yp,xi,style),... | 563 # %!assert (interp1 (xp,yp,xi,style),... |
564 # %! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) | 564 # %! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) |
565 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), | 565 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), |
566 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) | 566 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) |
567 %!error interp1 (1,1,1, style) | 567 %!error interp1 (1,1,1, style) |
568 ## ENDBLOCK | 568 ## ENDBLOCK |
576 %!assert (interp1 (xp',yp',xp,style), yp, 100*eps) | 576 %!assert (interp1 (xp',yp',xp,style), yp, 100*eps) |
577 %!assert (isempty (interp1 (xp',yp',[],style))) | 577 %!assert (isempty (interp1 (xp',yp',[],style))) |
578 %!assert (isempty (interp1 (xp,yp,[],style))) | 578 %!assert (isempty (interp1 (xp,yp,[],style))) |
579 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... | 579 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... |
580 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) | 580 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) |
581 # %!assert (interp1 (xp,yp,xi,style),... | 581 # %!assert (interp1 (xp,yp,xi,style),... |
582 # %! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) | 582 # %! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) |
583 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), | 583 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), |
584 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) | 584 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) |
585 %!error interp1 (1,1,1, style) | 585 %!error interp1 (1,1,1, style) |
586 %!assert (interp1 (xp,[yp',yp'],xi,style), | 586 %!assert (interp1 (xp,[yp',yp'],xi,style), |
593 %!assert (interp1 (xp',yp',xp,style), yp, 100*eps) | 593 %!assert (interp1 (xp',yp',xp,style), yp, 100*eps) |
594 %!assert (isempty (interp1 (xp',yp',[],style))) | 594 %!assert (isempty (interp1 (xp',yp',[],style))) |
595 %!assert (isempty (interp1 (xp,yp,[],style))) | 595 %!assert (isempty (interp1 (xp,yp,[],style))) |
596 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... | 596 %!assert (interp1 (xp,[yp',yp'],xi(:),style),... |
597 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) | 597 %! [interp1(xp,yp,xi(:),style),interp1(xp,yp,xi(:),style)]) |
598 # %!assert (interp1 (xp,yp,xi,style),... | 598 # %!assert (interp1 (xp,yp,xi,style),... |
599 # %! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) | 599 # %! interp1 (fliplr (xp),fliplr (yp),xi,style),100*eps) |
600 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), | 600 %!assert (ppval (interp1 (xp,yp,style,"pp"),xi), |
601 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) | 601 %! interp1 (xp,yp,xi,style,"extrap"),10*eps) |
602 %!error interp1 (1,1,1, style) | 602 %!error interp1 (1,1,1, style) |
603 ## ENDBLOCK | 603 ## ENDBLOCK |