Reputation: 21
I have experimental data for exponential distribution a*exp(b*x)
. the objetive is to find the coefficients a, b and their errors.
I have tried using the function fit(B,C, 'exp1')
and got some results.
Currently i'm experimenting problems because some data points in my file have higher error rate due to the nature of the experiment.
The concrete questions are:
Upvotes: 1
Views: 641
Reputation: 8477
Are you sure you are talking about the exponential distribution? If yes, I'm assuming you computed a histogram and now want to fit a line to the histogram. But that's not the best approach.
First, note that the probability density function of the exponential distribution has only a single parameter, due to the normalization of the pdf. The expression for the density is
lambda * exp(-lambda * x)
Secondly, you do not fit a distribution to data by fitting its pdf to a histogram. There are several approaches to parameter estimation, the most common is "maximum likelihood". According to Wikipedia, the maximum likelihood estimator of lambda is the inverse of the sample mean, or in Matlab notation:
lambda_est = 1 / mean(x)
To get a rough idea whether describing your data by this distribution makes sense, you can then plot the pdf using the estimated parameter over the (normalized) histogram, or over a nonparametric density estimate like that given by ksdensity
.
Upvotes: 1
Reputation: 13876
Use the fitoptions
argument to specify weights for the fit, or exclude some data points. See the fit
documentation for more details.
Upvotes: 1