Graphics Programs Reference
In-Depth Information
Linear formscan be fitted to databysetting up the overdetermined equations in
Eq. (3.22)
Fa
=
y
and solving themwith the command a=F
y (recall thatfor overdetermined equa-
tions the backslash operatorreturns the least-squares solution). Here is an illustration
how to fit
\
a 2 e x
a 3 xe x
f ( x )
=
a 1 +
+
to the data in Example 3.9:
xData = [1.2; 2.8; 4.3; 5.4; 6.8; 7.0];
yData = [7.5; 16.1; 38.9; 67.0; 146.6; 266.2];
F = ones(length(xData),3);
F(:,2) = exp(xData(:));
F(:,3) = xData(:).*exp(-xData(:));
a = F\yData
Search WWH ::




Custom Search