distributionFitter: Lognormal distribution

Hi
I wanted to fit my Data to the lognormal distribution, but I get this error message : "The data in X must be positive".
I am pretty sure that the data and the frequency arrays are positive (>=0).
How can I ovecome this issue.

5 comentarios

Torsten
Torsten el 9 de Feb. de 2023
Editada: Torsten el 9 de Feb. de 2023
Maybe there are NaN, Inf or -Inf values in your data vector ?
What does
any(Data(1,:) < 0)
return ?
Check it. We cannot because you didn't include the data.
Mohamed Zied
Mohamed Zied el 9 de Feb. de 2023
>> any(Data(1,:) < 0)
ans =
logical
0
I did, none of the values is negative. Actually, Data represents the bin edges. So logically, it can be negative. This error pops up only with Lognormal distribution.
Torsten
Torsten el 9 de Feb. de 2023
Editada: Torsten el 9 de Feb. de 2023
So you don't use the Data(1,:) directly to fit the lognormal distribution, but some preprocessed data that you don't know exactly ?
What about
any(Data(1,:) <= 0)
?
Mohamed Zied
Mohamed Zied el 13 de Feb. de 2023
Yes, I found some zeros.
I have to remove these values to be able to fitt my data to the Lognormal distribution.
Thank you for your help
Mohamed Zied
Mohamed Zied el 13 de Feb. de 2023
I predefined the bin edges. for some bins the count is 0. Thus, the error.

Iniciar sesión para comentar.

 Respuesta aceptada

Steven Lord
Steven Lord el 9 de Feb. de 2023
I am pretty sure that the data and the frequency arrays are positive (>=0).
0 is not positive. What does this command show?
any(Data(1, :) == 0)

1 comentario

Mohamed Zied
Mohamed Zied el 13 de Feb. de 2023
You are right. There are some zeros in my Data. I have to remove these values to be able to fitt my data to the Lognormal distribution.
Thank you for your help

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2020a

Preguntada:

el 9 de Feb. de 2023

Comentada:

el 13 de Feb. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by