Rotating values within a meshgrid

11 vues (au cours des 30 derniers jours)
Christina Boyce
Christina Boyce le 2 Oct 2019
I have X,Y,Z values from a bathymetry survey. I am able to create a meshgrid and grid the data just fine. The issue that I am experiencing is that since my survey area is not perfectly square (it is more of a diagonal rectangle, see below), there are an etreme amount of NaNs within my meshgrid. I have tried changing the NaNs to a number (like 0), as well as interpolating in the griddata function, but this is misrepresenting what is in my data. Ultimatly, I am trying to preform a SVD for the matrix, but I cannot have NaNs to run this function. The simplest solution I can think of is to 'rotate' the data within my meshgrid. Can anyone give advice?
Thank you,
survey area.PNG
meshgrid.PNG
Thank you,
Christina

Réponse acceptée

darova
darova le 2 Oct 2019
So maybe rotate your data and apply griddata() again
a = 45;
R = [cosd(a) sind(a); -sind(a) cosd(a)];
V = R*[x(:) y(:)]';
xnew = V(1,:);
ynew = V(2,:);
rangex = linspace(min(xnew),max(xnew),30);
rangey = linspace(min(ynew),max(ynew),30);
[X1,Y1] = meshgrid(rangex,rangey);
Z1 = griddata(xnew,ynew,z,X1,Y1);

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by