3D plot matlab with 3 equally sized vectors

10,691

Solution 1

Have you tried griddata or TriScatteredInterp to create an interpolated surface?

Solution 2

http://www.mathworks.com/matlabcentral/newsreader/view_thread/311767 gives the code snippet may help you.

X=rand(1,30);
Y=rand(1,30);
Z=rand(1,30);

[XI YI ZI] = griddata(X,Y,Z,linspace(0,1),linspace(0,1)');

figure
subplot(1,2,1)
trisurf(delaunay(X,Y),X,Y,Z)
subplot(1,2,2);
surf(XI,YI,ZI)
Share:
10,691
mallow
Author by

mallow

Updated on June 04, 2022

Comments

  • mallow
    mallow about 2 years

    I have three vectors, X, Y, and Z. All of equal length (20000,1). I want to plot all three in a 3d plot. I have tried using surf and plot3 but to no avail as they require Z to be of size (20000,20000). Can anybody help? TIA

    X = DAT(3,:);
    
    Y = DAT(4,:);
    
    Z = DAT(11,:);
    
    [x,y] = meshgrid(X,Y);
    
    surf(x,y,Z);