Rotating values within a meshgrid

12 Ansichten (letzte 30 Tage)
Christina Boyce
Christina Boyce am 2 Okt. 2019
Beantwortet: darova am 2 Okt. 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

Akzeptierte Antwort

darova
darova am 2 Okt. 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);

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by