3d_visualisation

조회 수: 1 (최근 30일)
Reyhaneh S. Ghazanfari
Reyhaneh S. Ghazanfari 2016년 1월 12일
댓글: Reyhaneh S. Ghazanfari 2016년 1월 12일
Hello!
I have drawn a 3d surface using the surf function. I would like to visualize the 3D volume enclosed between this surf and the x-axis. Would that be possible in Matlab?
Thanks!
Reyhaneh

채택된 답변

Mike Garrity
Mike Garrity 2016년 1월 12일
편집: Mike Garrity 2016년 1월 12일
There are some utilities for this on the file exchange, and there is the isocaps function which works with isosurface, but there isn't a builtin utility for adding "skirts" to the surface that the surf function creates.
It's actually relatively easy to do by hand. Here's a simple example:
% Create some interesting sample data
[x,y,z] = peaks;
z = z+3;
x = x(20:end,20:end);
y = y(20:end,20:end);
z = z(20:end,20:end);
[m,n] = size(z);
% Create the original surface
surf(x,y,z);
% Create 4 surfaces around the edges
hold on
walls(1) = surf([x( 1,:); x( 1,:)],[y( 1,:); y( 1,:)],[zeros(1,n); z( 1,:)])
walls(2) = surf([x(end,:); x(end,:)],[y(end,:); y(end,:)],[zeros(1,n); z(end,:)])
walls(3) = surf([x(:, 1), x(:, 1)],[y(:, 1), y(:, 1)],[zeros(m,1), z(:, 1)])
walls(4) = surf([x(:,end), x(:,end)],[y(:,end), y(:,end)],[zeros(m,1), z(:,end)])
set(walls,'FaceColor','interp')
But this only works if all of your Z values are on one side of the origin. If they cross, you need to do something similar to what I described in this blog post about a similar 2D problem.
  댓글 수: 1
Reyhaneh S. Ghazanfari
Reyhaneh S. Ghazanfari 2016년 1월 12일
Many thanks Mike!
Reyhaneh

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by