How to plot a surface-like plot when the data is not regularly spaced

5 次查看(过去 30 天)
I have 3-d data, where first two columns (x,y) are independent and the third column (z) is dependent upon first two. I want to have a surface plot of the data so that I can see what region in (x,y) space gives low values of z and what region gives high values of z. But I am not able to use a surface plot because the data is not regularly spaced as required for using 'surf'. I have attached the mat-file containing three columns for reference. Is there a good way of solving this problem?


Michal Dobai
Michal Dobai 2017-12-12
编辑:Michal Dobai 2017-12-12
How about this?
[xi,yi] = meshgrid(0:0.01:10, 0:0.01:10);
zi = griddata(demodata(:,1),demodata(:,2),demodata(:,3),xi,yi);
handle = surf(xi,yi,zi, 'EdgeColor', 'none');
% I adjusted color limits for better-looking plot of your data
handle.Parent.CLim = [-100 -80];
There is the whole page about it MATLAB in documentation: Interpolating Scattered Data
Result plot:
Is this what you need?
  4 个评论


更多回答(0 个)


Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息


Community Treasure Hunt

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

Start Hunting!

Translated by