Creating smooth surf plot from discrete values
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
mizuki
am 20 Dez. 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'
Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!