From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-08-2011 04:39 PM
I've been looking to use the PDF and CDF of the log-normal distribution, because atmospheric aerosols tend to follow those number distributions. However, both seem to be pretty badly garbled. Is there someone at NI I can talk to about this so it can be fixed?
I've made corrections to them and attached the vi's below. There is also the comparison between the built-in vi's and the corrected ones in 'lognormal problems.vi'.
PS. I wouldn't even look at the Wikipedia page for it, it's hopelessly wrong.
11-08-2011 06:20 PM
By my reckoning, the BD constant in the LogNormal PDF vi is wrong, b should be c and a should be b.
The simple definition is that ln(x) is a normally distributed variable with mean M and standard deviation S. Your reference prefers to call the mean ln(b) and the standard deviation ln(c). LV calls the mean ln(b) and the standard deviation c. You should be able to adjust for the different definitions if you want to use the built-in functions.
You have a similar typo in the fixed PDF vi, and you are missing a factor of x is the denominator of the coefficient of the exponential function, it should be
pdf = [1/(x*ln(c)*(2pi)^0.5]*exp[ -(ln(x/b))^2 /(2*(ln(c)^2) ]
Missing x is a bug in the code, ln(c) corrects a typo in the comment, but that part of the code is correct. Fixing that bug and adjusting for the different definitions and I get all of the calculations to match.
11-09-2011 01:43 PM
Thank you, Darin. Especially for the x; I wasn't sure whether to include it or not (the text I got it from discusses aerosols, and the distribution changes depending if you're talking about number, surface area, or size distribution). I should have integrated the thing numerically to check. In part, it is a matter of what you want one of the variables to be, the mean or the median. In the code I wrote, it's the median. They are related, where the mean = median*e^[((ln(c)^2)/2]. You can define the median and have the mean go up with an increasing deviation (c), or define the mean and have the median go down with increasing deviation. Deeper discussion in the help for this would improve things (which they may have done since the 8.5.1 that I'm using).
10-31-2017 03:30 AM
The lognormal indeed seem to be buggy but I respectfully disagree with the fix of MFiddler. If e.g. std is bigger then the median you get a negative value for the std for the normal distribution, which gives a NaN.
In attachment I fixed files for the lognormal distribution. Random generation of 100.000 numbers from this VI distribution revealed a correct median and std. I didn't look to the pdf yet, but should be copy paste.
Best regards,
Bo
10-31-2017 03:30 AM
The lognormal indeed seem to be buggy but I respectfully disagree with the fix of MFiddler. If e.g. std is bigger then the median you get a negative value for the std for the normal distribution, which gives a NaN.
In attachment I fixed files for the lognormal distribution. Random generation of 100.000 numbers from this VI distribution revealed a correct median and std. I didn't look to the pdf yet, but should be copy paste.
Best regards,
Bo