Home > Enterprise >  Interpolate in matlab
Interpolate in matlab

Time:01-28

I have two realizations for (X,Y)

(0, 200) (23, 700)

I want to find the value of Y at X1=12.5 with matlab with linear interpolation

Would interp1 work? but haven't figured out how to use the arguments

Thank you

CodePudding user response:

This does the thing:

enter image description here

x = [0,23];
y = [200,700];
xq = 12.5;
yq = interp1(x,y,xq)

%visualization
plot(x,y);hold on;
stem(xq,yq,'r')
  •  Tags:  
  • Related