Use griddata ignoring gaps in data
Mostra commenti meno recenti
I am using griddata on a scattered datatset (Data) to 'map' it onto a regular grid. The data is 2D and of the form: Data.x, Data.y, Data.z. The original data has some 'gaps'. All Data.x and Data.y values are valid with the 'gaps' being identified by Data.z = 0, and the remaining Data.z values are valid. Using griddata seems to still use these 'gap' data points and produces an output where the gaps are interpolated across using the surrounding 'valid' values. My code is as follows:
Data.Zgridded = griddata(Data.x, Data.y, Data.z, xgrid, ygrid);
where xgrid and ygrid are created using meshgrid.
My objective is to interpolate the scattered data onto a regular grid but omitting the 'gaps' from the interpolation (or assigning the gaps to NaNs or otherwise). Masking the data after griddata does not produce the correct result as the 'gap' data points are currently being incorrectly included in the first instance.
Any thoughts on how to tackle this are greatly appreciated.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Polar Plots in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!