How can i interpolate 1-D data, whit y especified values?
2 views (last 30 days)
Show older comments
camilo utrera
on 12 Aug 2022
Commented: camilo utrera
on 16 Aug 2022
Dear community
I want my interpolation to contain some specified values:
x = [1 2 3 4 6];
y = x^2;
xx = linspace(x(1),x(end),80)
vq = interp1(x,y,xx,'spline')
Let say that I want that vq contains y = 4.5 (or a set of values), and i have the x* value(s) that do y(x*) = 4.5 ( I alredy know that in this example y = 3.5 is a little off)
Thanks in advance.
0 Comments
Accepted Answer
the cyclist
on 13 Aug 2022
Unless I'm missing something, it sounds like you just want to interpolate x from y, instead of y from x:
x = [1 2 3];
y = [1 4 9];
yq = y(1) : 0.5 : y(end);
xq = interp1(y,x,yq,'spline');
[xq' yq']
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!