开发者

Subtract two trisurf plots from one another

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?


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(tri,X,Y,Z) % first plot
hold on
trisurf(tri,X2,Y2,Z2) % second plot
trisurf(tri,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: How Do I Generate a 3-D Surface From Isolines?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜