Plot 3 scale graph

조회 수: 3 (최근 30일)
Anoop
Anoop 2014년 11월 27일
댓글: Image Analyst 2014년 11월 28일
Hi I need help with this code.
Weight=(37000:2000:74000);
CG=(16:1:42);
Index=(((Weight/1000)*(CG-25)*0.041935)+50);
I want to do a scattered plot with Weight on the Y axis, Index on the X axis(Bottom) and CG on X axis (Top). Please help.
Regards Anoop

답변 (2개)

mashtine
mashtine 2014년 11월 27일
Hi Anoop, you can do this
Weight=(37000:2000:74000);
CG=(16:1:42);
Index=(((Weight/1000)*(CG-25)*0.041935)+50);
figure
h = scatter3(CG,Index,Weight);
First you will need to make sure your Weight and CG are of the same dimensions. One is 1x19 and the other is 1x27 of which you cannot calculate index from. Once you do that, from there you can look at all the scatter3 plot options to change the graph or you can do this interactively with the figure edit tools.
  댓글 수: 1
Anoop
Anoop 2014년 11월 27일
HI Masao,
I made it the same dimension
Weight=(22000:2000:74000);
CG=(16:1:42);
Index=(((Weight/1000)*(CG-25)*0.041935)+50);
figure
h=scatter3(CG,Index,Weight);
I am getting this error.
Error using *
Inner matrix dimensions must agree.
Error in Trimsheet (line 3)
Index=(((Weight/1000)*(CG-25)*0.041935)+50);

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


Image Analyst
Image Analyst 2014년 11월 27일
You need to use meshgrid to get all possible combinations of Weight and CG:
Weight=(37000:2000:74000);
CG=(16:1:42);
[x, y] = meshgrid(Weight, CG);
Index=(((x/1000).*(y-25)*0.041935)+50);
h = scatter3(y(:), Index(:), x(:));
  댓글 수: 4
Anoop
Anoop 2014년 11월 28일
Sorry I dint give you the complete details. I am only expecting the grid to be created in Matlab. As you can see the Y axis is Weight and X axis at the bottom is Index and the X axis at the top is CG. Thanks for your time.
Image Analyst
Image Analyst 2014년 11월 28일
I don't really know. Perhaps you can get it by manipulating the camera angle. Or else just create it at a very low level with calls to line().

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by