Why do I get different lognormal parameters using lognfit vs. using the fit function with the lognormal equation?

I am working to fit a lognormal distribution to in situ aerosol size distribution data. I have tried a variety of approaches. When I use lognfit or calculate mu and sigma by hand (calculating the mean and standard deviation of the natural log of the data), I get the same numbers (mu = -10.3954, sigma = 1.8503). However, the PDFs based on these values do not match the data at all. In the plot below, the blue represents the mu and sigma when I use lognfit or calculate by hand, and orange is my actual data.
I have also tried using the MATLAB "fit" function with a specified (lognormal) equation and initial guesses for the parameters. When I use this method, I get mu and sigma values that make more sense when looking at the data (mu = -1.8843, sigma = 0.3915). Below I show this lognormal pdf compared to the data.
I have been trying to reconcile the differences between these methods for days and can't seem to figure out anything that makes sense. In short, I am wondering why these methods are giving such different answers? Any help would be appreciated!

More Answers (0)

Categories

Find more on Curve Fitting Toolbox in Help Center and File Exchange

Products

Release

R2022a

Asked:

on 17 Jan 2024

Answered:

on 17 Jan 2024

Community Treasure Hunt

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

Start Hunting!