plot binary vectors ?

3 次查看(过去 30 天)
Susan Arnold
Susan Arnold 2016-5-3
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