MATLAB Answers

How to plot a 51*51*51 array

조회 수: 1(최근 30일)
desah
desah 2012년 11월 23일
답변: Michael scheinfeild 2014년 7월 9일
Hi, i'm a newbie of this community.I'm sorry for any next mistakes.For my thesis of dinamical of the structrures at university i have to calculate the pressure into an acustic hole.Here is the scripts for the calcus of this pressure in every point of the hole.the hole is a box with this dimensions(pi,2,1).i divided it into a grid of 51x51x51 points.
n_nod=51; %%%number of nodes for each side x=linspace(0,pi,n_nod); y=linspace(0,2,n_nod); z=linspace(0,1,n_nod);
r_int=zeros(n_nod,n_nod,n_nod);
Ppr=zeros(n_nod,n_nod,n_nod);
for i=1:1:n_nod for j=1:1:n_nod for h=1:1:n_nod
r_int(i,j,h)=((0.5-x(i))^2+(1.5-y(j))^2+(1.5-z(h))^2)^0.5;
Ppr(i,j,h)=1/(2*pi*r_int(i,j,h));
end
end
end
the script generate an array Ppr of 51x51x51 elements.I'd like to plot Ppr in a 3D graph in different colour in fuction of the each points. which command can add to the script to do this??? thanks to all for any answer!
  댓글 수: 3
changkun
changkun 2014년 7월 9일
slice

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

답변(3개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 23일
편집: Azzi Abdelmalek 2012년 11월 23일
mesh(Ppr(:,:,1),Ppr(:,:,2),Ppr(:,:,3))

desah
desah 2012년 11월 23일
편집: desah 2012년 11월 23일
thank you for the fast answer.I've tried to add mesh(Ppr(:,:,1),Ppr(:,:,2),Ppr(:,:,3)) after the for loop but it plots only the last values on a 3D space and it appears like a multicolour line.if i add the string into the for loop it never stops and goes in overclock.I just want to visualize a volume 51x51x51 points in differt colours.is it possible or not? Regard
  댓글 수: 6
desah
desah 2012년 11월 24일
x,y,z are 3 vectors of 51 points that form a grid box.(x,y,z=linspace(:,:.51)).I want to plot the matrix P that is function of x,y,z together.(I've calculated P in all the points of the space;you can verify this if you run my script,)In this way P is an array of 51*51*51 elements.I'd like to visualize a cube of different colours that represent the trend of the pressure inside the box in all points.

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


Michael scheinfeild
Michael scheinfeild 2014년 7월 9일
i think you need to look at volume visualization functions like figure,slice(Ppr,x,y,z)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by