Matlab interpolation of a hemisphere to a finer grid
3 views (last 30 days)
Show older comments
I've computed data on this hemisphere:
% Compute hemisphere coordinates
segments = 20;
theta = deg2rad(linspace(-180,0,segments))'; % Elevation (bottom half of a sphere)
phi = deg2rad(linspace(-180,180,segments)); % Azimuth
[phi,theta]=meshgrid(phi,theta);
zObsG = obsRadius.*sin(theta);
xObsG = obsRadius.*cos(theta).*cos(phi);
yObsG = obsRadius.*cos(theta).*sin(phi);
I want to interpolate this data now to a finer grid with more elements:
segmentsInterp = 100;
thetaInterp = deg2rad(linspace(-180,0,segmentsInterp))';
phiInterp = deg2rad(linspace(-180,180,segmentsInterp));
[phiInterp,thetaInterp]=meshgrid(phiInterp,thetaInterp);
zObsGInterp = obsRadius.*sin(thetaInterp);
xObsGInterp = obsRadius.*cos(thetaInterp).*cos(phiInterp);
yObsGInterp = obsRadius.*cos(thetaInterp).*sin(phiInterp);
I somehow struggle to use the interp or griddata functions in Matlab as it outputs for example: "The grid must be created from grid vectors which are strictly monotonically increasing." or "The number of input coordinate arrays does not equal the number of dimensions (NDIMS) of these arrays.". Any hints to interpolate the obtained data to the new grid?
Thanks a lot in advance!
1 Comment
Koundinya
on 11 Sep 2018
how are you using the griddata and interp functions here ? It would be easier to understand the error if you post the complete code
Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!