1

The equation is as follows:

y=|A-B*exp(-x/C)|

Where|| denotes absolute value.

2 Answers 2

3

The easiest way is to use the curve fitting toolbox in which you can define your own custom fitting function.

Another option is to install the ezyfit toolbox available here.

Sign up to request clarification or add additional context in comments.

4 Comments

I tried curve fitting toolbox, and used my own custom fitting function, but I don't know how to write the expression exp(-x/c), which leads to error in Matlab. And I also don't know how to express the absolute value.
Your equation has to be written in this way abs(a-b*exp(-x/c)) where abs() is the absolute value. Which kind of error do you get? In the curve fitting toolbox have you defined the dataset you want to fit? As an extra note: are you sure about your fitting equation? It looks a bit strange, maybe the absolute value is missplaced and the correct equation is a-b*exp(-abs(x)/c) that is symmetric around zero.
>> x=[25 50 100 180 300 500 750 1100 1500]; >> y=[3088 2284 908 592 2124 3293 3807 3963 3976]; Here is the data. But the fitting curve seems wrong. I did follow your instruction. What 's wrong with it?
you cannot use fit the function a-b*exp(-abs(x)/c) because the x data are not referred to zero! I got a decent fit taking into account the horizontal translation along the x axis introducing an extra parameter x0. So the modified function is a-b*exp(-abs(x-x0)/c). With the data you provided I got these parameters (in parethesis their confidence interval): a = 3905 (3265, 4545); b = 3931 (2432, 5431); c = 140.1 (25.82, 254.3); x0 = 162.5 (127.5, 197.6) The fit is not wonderful, but that's it.
0

try looking at the cftool command

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.