Creating smooth surf plot from discrete values

6 vues (au cours des 30 derniers jours)
Gregory jones
Gregory jones le 19 Déc 2016
Commenté : Gregory jones le 28 Déc 2016
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 commentaires
mizuki
mizuki le 20 Déc 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'
Gregory jones
Gregory jones le 28 Déc 2016
Thank you for the response, I have decided to try not get a surface purely because of how I want people to consider the output data. Thanks again for the code!

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by