How to create a 3D plot and split the values inside?
조회 수: 1 (최근 30일)
이전 댓글 표시
Let´s say I have 3 coordinates, x,y and z
x goes from 0 to 120 with a step of one
y goes from 0 to 200 with a step of one
z goes from -25 to 25
The values inside vary, for example:
vector = ( x, y , z)
2.5 = ( 10, 22, -5 )
How can I later make divisions on this data based on the value of the vector or values inside the entire matrix.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273988/image.png)
Something like the image above.
댓글 수: 0
채택된 답변
darova
2020년 2월 27일
Use logical operations
id = vector > 2.5;
plot3(x(ix),y(ix),z(ix),'.r') % plot only points where vector > 2.5
댓글 수: 12
추가 답변 (1개)
Mariana
2020년 3월 16일
댓글 수: 1
darova
2020년 3월 16일
Sure. Use scatteredInterpolant
p = isosurface(X,Y,Z,val,2);
xx = p.vertices(:,1);
yy = p.vertices(:,2);
zz = p.vertices(:,3);
patch(p,'facecolor','b','edgecolor','none')
F = scatteredInterpolant(yy,zz,xx); % Function of a plane (Y,Z)
Example of using
x1 = F(90,4)
plot3(x1,90,4,'oy')
Result
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277475/image.png)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!