How to make a cross section of the 3D plot ?
66 次查看(过去 30 天)
显示 更早的评论
How can I make a cross section of this plot. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/632380/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/632380/image.png)
I am want to get something like this but only one line of it (outline). ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/632385/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/632385/image.png)
1 个评论
Adam Danz
2021-5-27
Assuming your 3D plot was created by a vector of x coordinates, a vector of y coordinates, and a matrix of z coordinates, if you want a 2D slice along the XZ plane, you just need to choose a slice from your z-matrix (ie, a row or a column) and plot that vector against your x-vector.
采纳的回答
Star Strider
2021-5-27
Choose the appropriate ‘X’ and ‘Z’ (or ‘Y’ and ‘Z’) values from the matrix to get a cross-section.
[X,Y,Z] = peaks(50);
figure
surf(X,Y,Z)
xlabel('X')
ylabel('Y')
figure
plot(X(24,:),Z(24,:))
grid
figure
plot(X(11,:),Z(11,:))
grid
.
1 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!