How can I store fitdist output as a variable?
7 views (last 30 days)
Show older comments
fitdist outputs distribution parameters but how can I store the numbers to a variable?
0 Comments
Answers (2)
Star Strider
on 8 Jun 2015
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.
0 Comments
mj
on 13 Feb 2017
Edited: mj
on 21 Jul 2017
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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!