plot binary vectors ?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Star Strider
le 3 Mai 2016
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.
Réponses (1)
Brendan Hamm
le 4 Mai 2016
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 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!