Professional Documents
Culture Documents
When this is not the case, i.e. when y(x) depends on products or powers in
parameters), then the minimization of chi-square results in coupled
equations that in general cannot be solved. We may sometimes be able to
linearize it, as we saw last time, but generally we need to proceed by trial
and error.
y
i 4
A plot of the curves yi and y(x) are shown at right. 0.5
0
-3 -2 -1 0 1 2 3
x
y
Looks like a = 2.5, b = 1, c = 1 is the best so far. 1
y
Looks like a = 2.5, b = 1.2, c = 1 is the best so far. 1
0.5
0
-3 -2 -1 0 1 2 3
x
Now let’s try c=1.2, and repeat the whole thing again:
b=1.0 b=1.2 b=1.4 b=1.6 b=1.8
a=1.0 15.3064 14.8579 15.3022 16.6286 18.7497
a=1.5 6.5330 5.8522 6.5054 8.4939 11.6843
c=1.2 a=2.0 2.4672 1.5487 2.4021 5.0517 9.3174
a=2.5 3.1090 1.9475 2.9921 6.3022 11.6491
a=3.0 8.4585 7.0485 8.2756 12.2454 18.6794
1.5
y
0.5
0
-3 -2 -1 0 1 2 3
But note that once we have the parameters, we can plot a much smoother
x
Gaussian through the points by evaluating it at more x values.
2
1.5
1
y
0.5
Note that we could be even more precise by stepping with smaller steps.
-3 -2 -1 0 1 2 3
x
2= 1.29
You can refine this method to find the minimum more precisely. Once you
get close, you can make the step size smaller, and essentially zoom in to finer
precision.
Finally, you can improve even more by doing a gradient search, essentially
going downhill in multiple parameters at once.
y
Generally, it is usually good enough to 0.5
first 00
-5
-5 -4
-4 -3 -2 -1 0 1 2 3 4 5
options = fitoptions('gauss2') options.Lower = [0 -Inf 0 0 -Inf 0];x