Creating smooth surf plot from discrete values
3 views (last 30 days)
Show older comments
Hi Guys,
I'm trying to create a surf plot by doing this:
%Change lat/lon to polar coords
[x1,y1] = projfwd(mstruct,place_lat,place_lon)
plot(x1,y1,'x'); %Plot the points on 2D plane
[x2 y2] = meshgrid(x1,y1);
surf(x2,y2,grid_array);
Where grid_array is an array of values for given x2 and y2. The plot itself is just flat planes with no curves or interpolation (may be using that word wrong).
Would anyone have any ideas on getting a smooth curve between each grid_array result for a given (x2,y2)?
Your help is very much appreciated.
2 Comments
mizuki
on 20 Dec 2016
1. Check the sizze of the x2, y2, grid_array
2. Remove the EdgeColor
I could write smooth surface with the following code:
S = shaperead('usastatehi', 'UseGeoCoords', true, ...
'Selector',{@(name) strcmpi(name,'Massachusetts'), 'Name'});
proj = geotiffinfo('boston.tif');
lat = [S.Lat];
lon = [S.Lon];
grid_array = rand(length(lat), length(lon));
grid_array = sort(grid_array);
[x1, y1] = projfwd(proj, lat, lon);
plot(x1,y1,'x'); %Plot the points on 2D plane
[x2 y2] = meshgrid(x1,y1);
h = surf(x2,y2,grid_array);
h.EdgeColor = 'none'
Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots 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!