%% Designate Constant Value for All Queries Outside the Domain of x
% Define the sample points, x, and corresponding sample values, v.

x = [-3 -2 -1 0 1 2 3];
v = 3*x.^2;

%
% Specify the query points, xq, that extend beyond the domain of x.

xq = [-4 -2.5 -0.5 0.5 2.5 4];

%
% Now evaluate v at xq using the 'pchip' method and assign any values outside the domain of x to the value, 27.

vq = interp1(x,v,xq,'pchip',27)

% Copyright 2015 The MathWorks, Inc.