2D interpolation of scattered data

2 visualizzazioni (ultimi 30 giorni)
Senal Perera
Senal Perera il 22 Gen 2021
Commentato: Senal Perera il 22 Gen 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.

Risposta accettata

KSSV
KSSV il 22 Gen 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 Commento
Senal Perera
Senal Perera il 22 Gen 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by