tags:

views:

36

answers:

1

I have two sets of data vectors X, Y, Z and X2, Y2, Z2

I currently plot them using trisurf on different graphs. Can I plot them on the same graph even if X Y and X2 Y2 are different. Can I subtract the surface plots?

+1  A: 

Yes, you can plot 2 trisurfs on the same plot. Just use hold on after the first call, and hold off at the end.

To substract one trisurf plot from another I think you need to interpolate one set of X/Y coordinates to another. Try to use INTERP2 for this:

Z2i = interp2(X2,Y2,Z2,X,Y);
tri = delaunay(X,Y);
trisurf(X,Y,Z) % first plot
hold on
trisurf(X2,Y2,Z2) % second plot
trisurf(X,Y,Z2-Z2i) % difference
hold off

Hope it should work if your x and y data in both sets are in the same region.

EDIT: Use INTERP2 for X and Y generated by meshgrid. For vectors and how to use TriScatteredInterp see other SO question: http://stackoverflow.com/questions/1672176/how-do-i-generate-a-3-d-surface-from-isolines

yuk
Can't get interp2 to work. I think because X Y and X2 Y2 are not the same length.
Brian

related questions