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

조회 수: 2 (최근 30일)
Ayob
Ayob 2014년 1월 22일
답변: Walter Roberson 2014년 1월 23일
..
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?

채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 23일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by