(Solved) How to plot the variance of elements in each bin of histogram?
Mostrar comentarios más antiguos
Data: Array of real valued numbers. (say XArray)
To plot: A histogram superimposed with the plot of variance(/IQR) of elements
in each bin.
Also, how could i plot frequency on x-axis instead of y-axis.
Sincerely
1 comentario
gunjanthesystem
el 25 de Mzo. de 2014
Editada: gunjanthesystem
el 25 de Mzo. de 2014
Respuestas (2)
Chandrasekhar
el 24 de Mzo. de 2014
plot the histogram using hist command then hold the figure using hold on. then plot the variant using plot command
hist(array)
hold
plot(frequency,variance)
Image Analyst
el 24 de Mzo. de 2014
To get the counts:
counts = hist(data, numberOfBins);
To get the variance of the counts
countVariance = var(counts);
2 comentarios
gunjanthesystem
el 24 de Mzo. de 2014
Image Analyst
el 24 de Mzo. de 2014
You need to know the value that defines the start and stop value for each bin. Let's say it's v1 and v2. Then extract all the values in that range from your data
inRange = data > v1 & data < v2;
Now get the variance
dataRangeVariance = var(data(inRange));
This gets the variance of only those elements that fell into that particular bin.
Categorías
Más información sobre Histograms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!