MATLAB Answers

# How to fit data in exponential fit (R = exp(-q*D)) and find coefficient "q" using Maximum Likelihood Estimate (MLE)?

16 views (last 30 days)
Sajan K.C. on 31 Jan 2021
Answered: Jeff Miller on 31 Jan 2021
I have data sets (D and R). I want to fit the data in terms of custom exponential fit (R = exp(-q*D)) and find the coefficient using MLE. I would be thankful if somebody can help me by writing a code.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (2)

Star Strider on 31 Jan 2021
in the documentation for mle, see the section on pdf or cdf, dependong on what you are fitting.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

Jeff Miller on 31 Jan 2021
As I read this question, it is about fitting a model rather than a distribution, so I don't think mle is appropriate. Instead, I suggest:
logR = log(R);
a = fitlm(D,logR,'intercept',false)
The resulting "Estimate" will be a least-squares estimate of q. It may or may not also be maximum likelihood, depending on your assumptions about the model errors.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!