Creating smooth surf plot from discrete values

6 ビュー (過去 30 日間)
Gregory jones
Gregory jones 2016 年 12 月 19 日
コメント済み: Gregory jones 2016 年 12 月 28 日
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 件のコメント
mizuki
mizuki 2016 年 12 月 20 日
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 2016 年 12 月 28 日
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!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by