|
On Wed, 10 Mar 2010 19:15:06 -0500, Alexm Smith <aleisia@hotmail.com>
wrote:
> I have x,y,z data, each in a column, but I've tried different ways to
> get the 3D plot, z vs. x and y plane, of coz. Since I don't know the
> explicit function form of z concerning x and y.
> How can I do this?
> I want the 3D surface, not scattered points or curve.
> Thank you so much!
hint(s):
N=50;
x=rand(1,N);
y=rand(1,N);
z=x.*x+y.*y; %A irregular circular disc in 3D space
%% Simple, in raw data form
figure;plot3(x,y,z,'*');
%% As a 3D surface
%Create a regular grid to view on
step=0.05;
[xi yi]=meshgrid(min(x):step:max(x),...
min(y):step:max(y));
%Iterpolate the data on to the regular grid (griddata if you are on an
older release)
f=TriScatteredInterp(x',y',z');
zi=f(xi,yi);
%display surface
surf(xi,yi,zi)
|