- #1

ACLerok

- 194

- 0

y=20-a*10*log(x)

My problem is just getting a curve fit to this equation. What function in MATLAB should I be looking for? How do I get the value of 'a'?

Is it easier to achieve this in Excel? How?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- MATLAB
- Thread starter ACLerok
- Start date

- #1

ACLerok

- 194

- 0

y=20-a*10*log(x)

My problem is just getting a curve fit to this equation. What function in MATLAB should I be looking for? How do I get the value of 'a'?

Is it easier to achieve this in Excel? How?

- #2

chroot

Staff Emeritus

Science Advisor

Gold Member

- 10,275

- 40

All of the functions available in that menu are also available on the command line, but I find curve fitting to be much more intuitive when done in a plot window.

- Warren

- #3

ACLerok

- 194

- 0

will i be able to enter in my own custom equation? thanks

- #4

unplebeian

- 154

- 0

In Matlab I am sure you can enter your custom equations.

- #5

f95toli

Science Advisor

Gold Member

- 3,354

- 856

will i be able to enter in my own custom equation? thanks

Yes, you can fit to whatever function you want.

Note that if you use functions from the Optimization toolbox (if you have that installed) you can quite easily fit to a nonlinear Matlab function, i.e. you can "fit" to a piece of code which generates an output that depends on an number of inputs, even if the function includes e.g. interpolation (which is often used conventient when fitting to a large set of experimental data), if-then statements etc. This is often very useful.

Also, if you are able to rewrite your equations as a matrix equation (e.g. a sum of exponentials with unknown prefactors) you can of course also solve it directly, i.e. using something like "X\b" which gives you the best result in the least-square sense.

- #6

F.Moisy

- 1

- 0

You can also try Ezyfit, a free curve fitting toolbox for Matlab:

www.fast.u-psud.fr/ezyfit

In your case just type

showfit('y=20-a*10*log(x)')

if your data are plotted in a figure, or

f = ezfit(x,y,'y=20-a*10*log(x)')

if your data are stored into the vectors x,y.

Share:

- Last Post

- Replies
- 1

- Views
- 421

Mathematica
Finding a function to best fit a curve

- Last Post

- Replies
- 1

- Views
- 1K

MATLAB
How to plot data in MATLAB?

- Last Post

- Replies
- 2

- Views
- 500

- Replies
- 1

- Views
- 338

- Last Post

- Replies
- 10

- Views
- 1K

- Last Post

- Replies
- 1

- Views
- 692

- Last Post

- Replies
- 9

- Views
- 814

- Last Post

- Replies
- 5

- Views
- 2K

- Replies
- 0

- Views
- 251

- Last Post

- Replies
- 2

- Views
- 626