Environmental Engineering Reference
In-Depth Information
c = exp(polyval(p,[0:.2:8]));
plot(tfit,cfit,'o',[0:.2:8],c,'-');
Lets check again the quadratic difference between observed and modelled data:
c = polyval(p,tfit);
normc = norm (cfit-c)
normc =
3.6427
and check:
c = exp(-tfit);
normc = norm (cfit-c)
normc =
0.3915
Obviously the chosen function
cðtÞ¼
exp
ðtÞ
(10.5)
is a much better approximation for the example data set, showing that the
coefficients obtained before for the exponential fit do not represent the best fit.
The explanation for that apparent contradiction is nearby: the linear curve is found
under the condition that the sum of squares of the quadratic logarithmic deviations
P log
2 is minimized and not
ðc fit Þ
log
ðcðt fit ÞÞ
the sum of
the quadratic
deviations P c fit cðt fit Þ 2 . In the next sub-chapter, we present a better procedure
for the determination of the optimal exponential curve.
10.4 Parameter Estimation with Derivatives
MATLAB
offers the possibility to find the best exponential fit by another
procedure, which is demonstrated in the following. The method can be extended
for parameter fitting for arbitrary curves, i.e. it is not restricted to polynomial or
exponential curve fitting.
Remember that it is the goal to minimize the norm of the residual vector:
®
q
X cðt fit Þc fit
2
rekk¼
(10.6)
The square root operation within the norm formula does not change the result of
the task and can be omitted. Thus, the task can also be formulated without the
Search WWH ::




Custom Search