how to plot in three dimension (3D)

Hi, I am trying to do a 3D plot for 18 by 18 matrix containing a first structure "positions" (x,y coordinates), and a second structure containing "power" in db. I have about 20 files with the position and power structures in each file. I took all the positions from each file and put them in one single structure and the power in another structure. However, the positions repeat after 324 rows (18 X18 = 324). when i tried to plot, i got weird plot. Not sure why, but i am thinking when the positions repeat, the graph does not look right. below is the code i used to do the plot.
load('combine.mat');
Pow=positions.offsetdata;
Pos=[]; for i=1:length(power.positions); Poss=power.positions{i,1}; Pos=[Pos;Poss']; end
figure plot3(Pos(:,1),Pos(:,2),Pow)

답변 (1개)

Walter Roberson
Walter Roberson 2015년 10월 5일

0 개 추천

You should be considering using cell2mat() instead of looping putting the data together like that.
When you put the data together like that, there would be no breaks between layers.
What is the size() of Pow ?

댓글 수: 4

Ray
Ray 2015년 10월 5일
i tried to use mesh but it get this error "Z must be a matrix, not a scalar or vector".
Walter Roberson
Walter Roberson 2015년 10월 5일
You are trying to create a 3D plot with repeated x and y. That sounds like you have implicit z coordinates according to which file it is. If that is the case then each point implicitly has x, y, z, and power. That would require a 4D plot, or a 3D plot with color. However, a 3D plot with color usually has difficulty in allowing you to look "into" the plot.
Ray
Ray 2015년 10월 5일
The size of Power is 1296
Walter Roberson
Walter Roberson 2015년 10월 5일
Please clarify about whether you have implicit z coordinates or if the power is to be your z coordinate. If the power is to be your z coordinate then are the different files taken at different times and you need to create an animation?

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

Ray
2015년 10월 5일

댓글:

2015년 10월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by