plot binary vectors ?
4 ビュー (過去 30 日間)
古いコメントを表示
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
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
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')
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!