How to convert y data for equal intervals of x, z to z data for equal intervals of x, y
Afficher commentaires plus anciens
x and z are tables of size 100x100 using meshgrid.
Values outside the required range of z are treated as NaN.
The y value is the result of the calculation using x and z.
If the result of the calculation for z is a complex number, NaN is processed.
What code should I use to find z for equally spaced x, y?
An error occurs when trying to do 3D interpolation.
I attached the variable as an attachment.
I would greatly appreciate your help.
1 commentaire
Madheswaran
le 12 Nov 2024
@Yunjai Could you also post the minimal version of code you were trying to run and the error you were facing?
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 12 Nov 2024
Déplacé(e) : Walter Roberson
le 12 Nov 2024
load example.mat
XYZ = [X(:), Y(:), Z(:)];
XYZ = rmmissing(XYZ,1);
F = scatteredInterpolant(XYZ(:,1), XYZ(:,2), XYZ(:,3));
[minx, maxx] = bounds(X, "all");
[miny, maxy] = bounds(Y, "all");
[XG, YG] = ndgrid(linspace(minx, maxx), linspace(miny, maxy));
ZG = F(XG, YG);
surf(XG, YG, ZG);
shading interp
Catégories
En savoir plus sur Interpolating Gridded Data dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

