2D interpolation of scattered data

4 Ansichten (letzte 30 Tage)
Senal Perera
Senal Perera am 22 Jan. 2021
Kommentiert: Senal Perera am 22 Jan. 2021
x = [1 2 3 4 5];
y = [1 2 3 4 5];
z = [1 2 1 2 3; 3 4 3 4 5; 5 6 5 6 7; 3 4 3 4 5; 1 2 1 2 3];
Hi,
Is there a method to get the value of x as the output when the inputs are y = 2.5 and z = 4.5.
Where X is a 1*5 matrix, Y is a 1*5 matrix and Z is a 5*5 matrix as shown above.
Thanks in advance.

Akzeptierte Antwort

KSSV
KSSV am 22 Jan. 2021
x = [1 2 3 4 5];
y = [1 2 3 4 5];
z = [1 2 1 2 3; 3 4 3 4 5; 5 6 5 6 7; 3 4 3 4 5; 1 2 1 2 3];
[X,Y] = meshgrid(x,y) ;
idx = knnsearch([Y(:) z(:)],[2.5,4.5])
  1 Kommentar
Senal Perera
Senal Perera am 22 Jan. 2021
Thank you so much man. You are the best. Since the issue is solved, I can continue with the rest of my project. Thanks again.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by