31 views (last 30 days)

I want to fit below equation J(v). J and V data areavailable.

N=10^21

q=1.6x10^-19

Epsilon=26.5 x 10^-14

d=3x10^- 6

Initial values may be x0=[µ l H]=[10^-5 5 10^18]

3 fitting parameters are: µ, l and H. other parameters are known.

can some one help me to solve this?

I am not expert in Matlab

V is xdata:

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

5.5

6

6.5

7

7.5

8

J is ydata:

1.64544E-05

1.99822E-05

0.000032253

4.2623E-05

7.40498E-05

0.000660899

0.007578998

0.027109725

0.106353025

0.30299725

0.7332185

1.550115

2.98009

5.3102775

8.88175

14.0394325

21.163215

Jeff Miller
on 25 Mar 2020

I assume you have vectors of values for V and J, in which case fminsearch might be a good choice. The basic steps are:

- Write a function "predicted" to compute a predicted value of J for any given V, µ, l and H.
- Write a function "error" that computes the sum of (predictedJ - actualJ)^2, summing across the J vector.
- call fminsearch and pass it this error function as the function to be minimized. You will have to give it reasonable guesses for µ, l and H.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 9 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_815622

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_815622

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_815760

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_815760

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_815813

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_815813

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816120

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816120

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816129

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816129

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816224

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816224

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816252

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816252

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816256

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816256

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816360

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/512799-how-to-fit-complicated-function-with-3-fitting-parameters-using-least-square-regression#comment_816360

Sign in to comment.