I'm trying to plot a smooth line for 6 points in such a way that slope at each is zero. I have successfully achieved it for middle points using 'pchip' but I also want it for extreme points i.e. x=0 and x=15 which I am unable to do while using 'pchip'.
Here is my code
clearclcx = [0;3;6;9;12;15];y = [0;1.9190;-3.2287;3.5133;-2.6825;1];xi = linspace(min(x), max(x), 150); % Evenly-Spaced Interpolation Vector
yi = interp1(x, y, xi, 'pchip');figureplot(x, y, 'b')hold onplot(xi, yi, '-r')hold offgridxlabel('X')ylabel('Y')legend('Original Data', 'Interpolation', 'Location', 'NE')
Best Answer