From: Frédéric Bergeron on
Hi,

I want have a set of x,y and z data. I want to produce a 3d surf plot that looks like this from the x-y view: http://pics.imagup.com/ano1/1279019256.jpg .

I tried to use trisurf, combined with delaunay and meshgrid functions, but the boundaries of my data are not connecting with long distance points, as it does in the image from the hyperlink. I want clean boundaries lines, that will look like a turned rectangle, using my sample code below. Is there a way to do it?? Here's is my sample test code so far:

%Test data
x=1:20;
y=1:20;
[xgrid,ygrid]=meshgrid(x,y);
zgrid=xgrid+.5*ygrid+2*rand(20,20);

%Some NaN in my reel data
zgrid(ygrid>xgrid+5)=NaN;zgrid(ygrid<xgrid-5)=NaN;
zgrid(ygrid<-xgrid+4)=NaN;zgrid(ygrid>-xgrid+32)=NaN;

%Triangulation
tri=delaunay(xgrid,ygrid);
handles.graph_champ_reel=trisurf(tri,xgrid,ygrid,zgrid);
%Not connecting data with lines longuer than sqrt(2)...
%that the image from the hyperlink does...

Thank you very much. Best regards,
Fred
From: Frédéric Bergeron on
Hey,
Just to say I have found my mistake, so I don't need help for that anymore. It was related to the presence of NaN values in some of the matrixes, but not in all of them. If anyone's interested, here's the code that works the way I wanted:

%Test data
x=1:20;
y=1:20;
[xgrid,ygrid]=meshgrid(x,y);
zgrid=xgrid+.5*ygrid+2*rand(20,20);

%Some NaN in my reel data: indexing,
%THEN putting the NaNs in every matrix
idx1=ygrid>xgrid+5;
idx2=ygrid<xgrid-5;
idx3=ygrid<-xgrid+4;
idx4=ygrid>-xgrid+32;

xgrid(idx1)=NaN;xgrid(idx2)=NaN;
xgrid(idx3)=NaN;xgrid(idx4)=NaN;

ygrid(idx1)=NaN;ygrid(idx2)=NaN;
ygrid(idx3)=NaN;ygrid(idx4)=NaN;

zgrid(idx1)=NaN;zgrid(idx2)=NaN;
zgrid(idx3)=NaN;zgrid(idx4)=NaN;

%Triangulation WITHOUT the NaNs
tri=Delaunay(xgrid(~isnan(xgrid)),ygrid(~isnan(ygrid)));
trisurf(tri,xgrid(~isnan(xgrid)),ygrid(~isnan(xgrid)),zgrid(~isnan(xgrid)));
From: Christopher Rouxel on
Frédéric,
I just uploaded this GUI that should help you do this quickly.
http://www.mathworks.com/matlabcentral/fileexchange/28177-3d-performance-map-gui
good luck,
Christopher