MATLAB: Row interpolation by adding data at end of the matrix

curve fittinginterpolationMATLAB

I have a variable d which is a row matrix of 1×18
d=[24.1615256950601 24.1615256699363 24.1615256438020 24.1615256182430 24.1615256053197 24.1615255801960 24.1615255672726 24.1615255402679 24.1615255131230 24.1615255004873 24.1615254753636 24.1615254509627 24.1615254248284 24.1615254114699 24.1615253988342 24.1615253870690 24.1615253734228 24.1615253590537]
I want to extend the length of the matrix to 1×20. If I am using interp1 it's showing NAN at pos 19,20.
I want to extend the curve to 20 points how should I do it…???

Best Answer

>> V = interp1(1:18,d,1:20,'pchip','extrap');
>> V(:)
ans =
24.1615256950601
24.1615256699363
24.1615256438020
24.1615256182430
24.1615256053197
24.1615255801960
24.1615255672726
24.1615255402679
24.1615255131230
24.1615255004873
24.1615254753636
24.1615254509627
24.1615254248284
24.1615254114699
24.1615253988342
24.1615253870690
24.1615253734228
24.1615253590537
24.1615253439804
24.1615253282587