Surf plot of my data
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello;
I have data in the following format : [X1 X2 F] where X1, X2 and F are all column vectors. F is a function evaluated on X1 and X2. I do not know what function it is, I only have the end result.
I successfully plotted my data using
% trainset contains the data as presented above
scatter3(trainset(:,1),trainset(:,2),trainset(:,3),30,trainset(:,3));
% I use the value of F for the coloring of the datapoints
However I would prefer a real surface plot, using surf(). But the format of my data is not suited to surf, apparently.
I thought about using meshgrid to make the grid matrices for X1 and X2, but since I don't know the function F, I won't be able to evaluate it on those grids ; I'm stuck with the dataset I'm provided with, in which F is already evaluated for some pairs of X1 and X2.
I might be missing something obvious but I really don't see how to get a surface plot with that kind of "blackbox" data.
Thanks in advance for your insights!
댓글 수: 0
답변 (2개)
Walter Roberson
2013년 4월 2일
Use griddata(). Or use triscatteredinterp to create an interpolator and interpolate it over a mesh created with ndgrid()
댓글 수: 0
Omid Adljuy
2013년 4월 5일
Probably the TriScatteredInterp command will help you do what you're looking for.
See MATLAB Help for mor details and examples.
This tutorial video shall also help.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!