Interpolating contour plot using user input

31 visualizaciones (últimos 30 días)
Radhika Kulkarni
Radhika Kulkarni el 19 de En. de 2021
Comentada: piston_pim_offset el 18 de Nov. de 2023
Hello,
I have created a 2D contour map using a 25x19 matrix and was wondering how to interpolate the value at certain user-input x-y coordinates? Essentially, I want the user to enter coordinates that are either integer or decimal, and for the code to output the value at that corresponding location. Any help would be appreciated :)
data = readmatrix('pixeltxt.txt');
contourf(data);
grid minor

Respuesta aceptada

Bram Schroeders
Bram Schroeders el 20 de En. de 2021
I think taking a look at this documentation may help you https://www.mathworks.com/help/matlab/ref/scatteredinterpolant.html
  13 comentarios
Bram Schroeders
Bram Schroeders el 26 de En. de 2021
You can use the rescale function:
So for instance you have a vector called A and you want to set the x-axis to [-21.4 -19.6] and y-axis to [-17.5 -15] you can do this:
A(:,1) = rescale(A(:,1),-21.4,-19.6);
A(:,2) = rescale(A(:,2),-17.5,-15.0);
I think this is what you mean
piston_pim_offset
piston_pim_offset el 18 de Nov. de 2023
Thanks for your answers Bram Schroeders

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by