필터 지우기
필터 지우기

plot binary vectors ?

조회 수: 3 (최근 30일)
Susan Arnold
Susan Arnold 2016년 5월 3일
답변: Brendan Hamm 2016년 5월 4일
I have 2 vectors X and Y which represent spatial distribution of specific data points(100 points) as 2 column-vectors, they consists of 0s and 1s and I want to show their distribution in such a plot. I tried with the normal plot, scatter and a couple of Matlab commands, but the Matlab showed all points in one place (across 1 in the x-axis), which does not represent what am I looking for. I would be very grateful, if you could help me.
  댓글 수: 1
Star Strider
Star Strider 2016년 5월 3일
What sort of ‘distribution’ plot do you want?
If all the data are either [0,1] or [1,0], a spatial plot is going to simply overplot them.
If you want to plot them as a function of row number, create a row number vector and use the stem function to plot them against it.
If you are looking for the distribution of distances between the 1 values or something similar, that would be easy enough to determine using the find and diff commands, and then you could fit that result to a Poisson distribution and plot it with the Statistics and Machine Learning Toolbox function histift.

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

답변 (1개)

Brendan Hamm
Brendan Hamm 2016년 5월 4일
Would you be looking for something like this?
x = randi([0,1],100,2);
histogram2(x(:,1),x(:,2),'Normalization','pdf')
xlabel('x_1')
ylabel('x_2')

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by