1D griddedInterpolant of a vector of query points.
1 回表示 (過去 30 日間)
古いコメントを表示
Is it possible to use griddedInterpolant in a vectorized form? I have a vector function f sampled over time domain t which must be interpolated.
The following relations follow: size(t,2) = size(f,2) and size(t,1) < size(f,1).
Here is a simple example that works with interp1 and spline.
Is there a way to achieve the same outcome with griddedInterpolant?
% works!
t = linspace(0,5,100);
f = [sin(t); cos(t)]; % define some vector function
pp = interp1(t, f', 'pchip','pp'); % warning, Matlab suggests to use griddedInterpolant
% or
pp2 = spline(t, f);
% This throws an error:
F = griddedInterpolant(t, f); % ! how to make use of this function with a vector function? !
f = sin(t) % now f is a scalar function
F = griddedInterpolant(t, f); % now this line works
2 件のコメント
Star Strider
2020 年 4 月 22 日
I get no errors (R2020a) with everything except the griddedinterpolant call (that I did not run). What do you want to do? What result do you want?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!