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’
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
4 Comments
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_793846
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_793846
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_793848
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_793848
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_793849
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_793849
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_794041
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/503805-interpolation-in-a-vector#comment_794041
Sign in to comment.