How can I draw surf (semi-surf) for non square X-Y base plane?

2 views (last 30 days)
..
I have assembled some nodes in X-Y plane as shown below.So I have a pair for each node [x y] which I assemble them in two matrices:
X=[x(1) x(2) x(3) ... x(537)]
X=[y(1) y(2) y(3) ... y(537)]
x(i) and y(i) stands for each node which is numbered in the figure shown above. I have calculated value like W fore each node.
I want draw continues surfaces which show me changes with help of pairs [x(i) y(i) W(i)]. How can I do it, because I can not use normal MATLAB surf order (My nodes are scattered in a similarly triangular form.)
As you see free spaces which don't have any nodes within in the figure should not be interpolated and shown on the final surface. Is there any way in MATLAB for such a non Square X-Y plane?

Accepted Answer

Walter Roberson
Walter Roberson on 23 Jan 2014
If you use TriScatteredInterp or the newer GriddedInterpolant, feeding in your (x,y,w) values, and interpolating into the full square grid using an interpolating routine which will not extrapolate, then the points outside the defined area will get filled with NaN. contour() treats NaN areas as holes.
If your points exactly match rectangular grid locations (the impression given by the diagram) then you can convert the (x,y) entries to I, J indices into a rectangular array that you initialized as NaN; write the w values there. sub2idx() might be useful in this pursuit. Then after contour(). If your conditions are right for this to work, this would be much faster than the interpolating method.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!