Rotating values within a meshgrid
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Christina Boyce
el 2 de Oct. de 2019
Respondida: darova
el 2 de Oct. de 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 comentarios
Respuesta aceptada
darova
el 2 de Oct. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!