The error happens because "interp1" requires the values of "x" to be distinct.
returns a 1x4 vector. Meaning there are duplicate values.
I suggest using the following instead:
[~, ind] = unique(x)
vq = interp1(x(ind)',v(ind)',xq','linear','extrap')'
This will return the indices of the unique values in "x". Then you can call "interp1" on "x" and "v" as before, but this time pass the distinct element only.
There is one unique value in "vq" as expected since all the values in "v" are the same.
Best Answer