probability of occurence of a specific value

3 visualizaciones (últimos 30 días)
Camilla Santicoli
Camilla Santicoli el 10 de Mzo. de 2015
Comentada: Camilla Santicoli el 10 de Mzo. de 2015
Hi all! I have a question concerning the probability of occurence of a specific value. I have a set of precipitation data and would like to find the frequency histogram for precipitation values equal to zero. is there someone here who is able to solve this easy problem? :) thank you

Respuestas (3)

Image Analyst
Image Analyst el 10 de Mzo. de 2015
Have you looked into the histogram functions?
Or fitting routines like polyfit() or more sophisticated tools in the Curve Fitting Toolbox?
  1 comentario
Camilla Santicoli
Camilla Santicoli el 10 de Mzo. de 2015
yes but I don't know how to say to the hisotgram function to plot only values equal to zero...because usually it asks me to define a range of values in which I want the plot

Iniciar sesión para comentar.


Guillaume
Guillaume el 10 de Mzo. de 2015
You must have at least two bins for the histogram functions, you could just set the threshold of the second bin to something very small:
h = histc(data, [0 0.00001]);
But if you really just want the number of values equal to 0:
num0 = sum(data == 0);
%or num0 = sum(abs(data < 0.00001)) if you want to include values very close to 0
  5 comentarios
Guillaume
Guillaume el 10 de Mzo. de 2015
moreover I would like to plot a relative frequency histogram instead of the normal one
I assume that's what you want:
precipitationhistogram = precipitationhistogram / sum(precipitationhistogram);
Or use the new histcounts:
precipitationhistogram = histcounts(filteredprecipitation, [0 0.1 1 3 10 Inf], 'Normalization', 'probability');
Camilla Santicoli
Camilla Santicoli el 10 de Mzo. de 2015
really thank you for youranswer! I solved the problem:)

Iniciar sesión para comentar.


Camilla Santicoli
Camilla Santicoli el 10 de Mzo. de 2015
ok I understood it! but the plot doesn't work...
  5 comentarios
Guillaume
Guillaume el 10 de Mzo. de 2015
I'm replying in a comment to my original answer
Camilla Santicoli
Camilla Santicoli el 10 de Mzo. de 2015
yes that's perfect! thank you very much! do you also know how to plot it with relative frequency?

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by