Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Why is interp1(x,Y,...) being removed?

$
0
0

> Do you understand the latest version fully, Bruno? I can't test what it
> really does...and so far I don't follow what the doc is trying to say.
>
> Is it indeed just terribly poorly written documentation or is there some
> other functionality actually included now beyond that of simply
> interpolation on the columns of the array Y?

I haven't actually tried more than 2 dimensions in Y, but I believe it will interpolate datasets in every dimension of Y provided the first dimension is the same length as x,

e.g.

x = linspace(0,2*pi,10)';
xi = [0,pi/4,pi]';
Y = sin(x);
interp1(x, Y, xi)

ans =

     0.0000e+000
   685.5401e-003
    55.5112e-018


Y = [sin(x), cos(x)];

interp1(x, Y, xi)

ans =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003

Y(:,:,1:6) = repmat([sin(x), cos(x)], [1,1,6]);

interp1(x, Y, xi)

ans(:,:,1) =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003


ans(:,:,2) =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003


ans(:,:,3) =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003


ans(:,:,4) =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003


ans(:,:,5) =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003


ans(:,:,6) =

     0.0000e+000 1.0000e+000
   685.5401e-003 691.9949e-003
    55.5112e-018 -939.6926e-003

and so on, which is really quite cool functionality as I can imagine arranging my data in a way that was physically meaningful for multiple degrees of freedom.

Viewing all articles
Browse latest Browse all 19628

Trending Articles