Rotating values within a meshgrid
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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,


Thank you,
Christina
0 Kommentare
Akzeptierte Antwort
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);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!