How can I store fitdist output as a variable?
Show older comments
fitdist outputs distribution parameters but how can I store the numbers to a variable?
Answers (2)
Star Strider
on 8 Jun 2015
1 vote
I don’t believe that’s possible. The fitdist function outputs a ‘probability distribution object’, apparently available only to specific functions.
If you want the parameters and confidence intervals, use the appropriate distribution fitting functions: normfit, poissfit, etc.
You can access the output parameters like you access the fields of a struct, but you need to know the names of the parameters:
nu=8;
mu=4;
sigma=7;
nmc=100000;
x = mu + sigma * trnd(nu,nmc,1);
tls = fitdist(x,'tlocationscale')
[tls.mu tls.sigma tls.nu]'
Or you can access the names and values with tls.ParamNames and tls.Params. Use fieldnames(tls) for more info.
Categories
Find more on Half-Normal Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!