▲ 2 r/matlab
Does interp1 function query at the exact point you input?
I have a position & velocity time-series, and I want to find the velocity at all points when position crosses zero. To make sure I get every crossing, I've been linearly approximating the correct time (with the point-slope formula).
Then, I've been fitting a spline through 5 neighboring points and using the interp1 function to solve for velocity at these points:
vel_star = interp1(t(window), vel(window), t_star, 'spline');
Is there any deciding matlab does with this function? As in, are we really solving for velocity when t is exactly equal to t_star? Or would it be better to fit a function to the nearby points?
I'm not familiar with this function, so any help would be really appreciated!
u/Lively_Raccoon — 13 days ago