Antenna_X_Pos=[-0.0012;0.1419;-0.0672;-0.1121;0.1173;0.0653;-0.1458;0];
Antenna_Y_Pos=[0.1495;-0.0374;-0.1328;0.0896;0.0880;-0.1347;-0.0340;0];
Antenna_Z_Pos=[0.1269;0.0798;0.0428;0.0002;-0.0407;-0.0816;-0.1249;0];
%scatter3(Antenna_X_Pos,Antenna_Y_Pos,Antenna_Z_Pos),view(-90,90)
%grid on
for j=1:360
theta(j)= j / 180 *pi; % [Edited, Jan Simon: inlined "degtorad()"]
for m=1:90
sita(m)= m / 180 *pi;
[SP_X(j,m) SP_Y(j,m) SP_Z(j,m)] = sph2cart(theta(j),sita(m),10);
for i=1:numel(Antenna_X_Pos)
Distance(i,j,m) = sqrt(((Antenna_X_Pos(i) - SP_X(j,m))^2 +(Antenna_Y_Pos(i) - SP_Y(j,m))^2+(Antenna_Z_Pos(i) - SP_Z(j,m))^2));
end
end
end
Distance
How can I plot Distance in 3D (using i,j,m) ?

9 Comments

Jan
Jan on 19 Dec 2011
We cannot run your code. degtorad and Antenna_X_Pos etc are not known.
what kind of 3D visualization do you want?
zozo
zozo on 19 Dec 2011
sorry..I have made the required changes. Now the code works!
How can I plot and view all coordinates of Distance vector?
Jan
Jan on 19 Dec 2011
The output "Distance" is a [8 x 360 x 90] array. How do you want to visualize this? As surface, as 3D-polar-plot, as set of 8 discs with different colors?
zozo
zozo on 19 Dec 2011
Can u tell me all the above mentioned types?
Coz I am not sure which one is best right now.
zozo
zozo on 19 Dec 2011
please suggest me matlab syntax to plot the above vector
Jan
Jan on 19 Dec 2011
Dear zozo, the variable "Distance" is not a vector, but a [8 x 360 x 90] array. It is not trivial to plot it and I will not post examples for all possibilities - there are too many.
Please take the time to find out, how you want to display these data. You can draw a picture by hand and post it.
zozo
zozo on 20 Dec 2011
Dear Simon,
surface plot is what Iam looking for.
Walter Roberson
Walter Roberson on 20 Dec 2011
You cannot surface plot an 8 x 360 x 90 array. The closest you can come is to use isosurface()
zozo
zozo on 20 Dec 2011
thank you @walter

Sign in to comment.

Answers (1)

James Ryland
James Ryland on 11 May 2017

0 votes

If you store your distance data as 3D array 8 x 360 x 90 you have several ways to visualize what it looks like.
Both of these solutions turn 3D scaler fields into voxels with color and transparency, thus allowing you to visualize 3D density or distance fields.
Solution 1: Volumetric 3 is a full matlab application for visualizing layered 3D density matrices. It was designed to work with fmri and mri but it can handle arbitrary 3D arrays stored as .mat files.
https://www.mathworks.com/matlabcentral/fileexchange/59161-volumetric-3?s_tid=srchtitle
Solution 2: A much simpler tool is Vol3D. But with a lot of programming on your end you can get it to do pretty much anything volumetric 3 does, in that they use highly similar (though distinct) techniques for generating visualizations.

Asked:

on 19 Dec 2011

Answered:

on 11 May 2017

Community Treasure Hunt

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

Start Hunting!