interpolation in a vector
3 views (last 30 days)
Jyothis Gireesh on 11 Feb 2020
I am assuming here that you want to replace the sample corresponding to t=9 using linear interpolation. The following line of code may be helpful in solving this.
newValue = interp1([1:8 10], [v(1:8) v(10)], 9);
It is also possible to change the interpolation technique by specifying it as an additional input argument. For instance, if ‘pchip’
technique is to be used,
newValue = interp1([1:8 10], [v(1:8) v(10)], 9, 'pchip');
Please refer to the following documentation link on “interp1()” for any further clarifications
Hope this helps!!