필터 지우기
필터 지우기

How to plot this type of data in MatLab?

조회 수: 1 (최근 30일)
Gianluca Regina
Gianluca Regina 2020년 11월 28일
댓글: M.Many 2020년 11월 29일
Dear MatLab users,
I'm trying to plot some data but I'm having some problems and I don't know which function is the most appropriate. What I need to do is the same as the chart below built on excel.
I have a vector of results, A, which is 360x1; a vector D which is 40x1, and a vector M which is 9x1 (note that 40*9=360). The vector A is built such that the first 40 elements refer to the first value of the M vector, and to the 40 elements of the vector D. The elements 41 to 80 refer to the second value of the M vector, and so on. In other words, the plane grid is defined by the vectors D and M, which are the x,y "coordinates" of the 360 values of the vector A.
How can I plot these values in MatLab? I searched a bit and I tried to use functions such as bar3 and hist3, but I failed.
% A is known from previous analyses
D = linspace(2.5 , 197.5 , 40 )';
M = linspace(4.75, 8.75, 9)' ;
% hist3( ?)
% bar3(?)
Another question similar to this one is to divide every parallelepiped in 6 parts (hence, a 2160=40*9*6 result vector), which correspond to a 6x1 vector of predefined values. The final result should look like the screen_2 attached. I assume the code to be similar to the one of the first question, but again, not sure how to do it.
Thank you

채택된 답변

M.Many
M.Many 2020년 11월 28일
Hi,
you can try this
%load A
D = linspace(2.5 , 197.5 , 9 )';
M = linspace(4.75, 8.75, 9)';
bar3(reshape(A,40,9))
set(gca,'XTickLabel',M)
set(gca,'YTickLabel',D)
This is the closest I could get to the solution, hope it helps
  댓글 수: 4
Gianluca Regina
Gianluca Regina 2020년 11월 29일
Yes, that seems to work pretty well, though the bar3 function is indeed limited and some manual adjustments are necessary. Still, I have really good starting point now, thank you very much!
M.Many
M.Many 2020년 11월 29일
My pleasure.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by