dh-Materialien Einführung in Maple    Übungen
|  Home  |  Back  |  <   >  |

Mathematik
 

Einführung in Maple
  Hinweise
  Übersicht
  Übungen
  Anwendungen
  Stichworte
  Download
 

Bestimmen einer Ausgleichsgeraden

restart; with (plots):
Warning, the name changecoords has been redefined

Messtabelle:

M:=  [[2.1,  .425],
      [2.2,  .351],
      [2.4,  .281],
      [2.6,  .228],
      [2.7,  .137],
      [2.8,  .163],
      [2.9,  .084],
      [3.0,  .047],
      [3.1,  .013],
      [3.3, -.048],
      [3.5, -.099],
      [3.7, -.142]]:

 

plot ({seq (M[i], i = 1..nops(M))}, x = 2..4,
      style = point, symbol = cross,
      labels = [x, y]);

[Maple Plot]

Die Funktionsgleichung  der "besten Gerade":

f:= x -> m*x + b;

Die Summe der Gauss'schen Fehlerquadrate:

S:= (m, b) -> sum ((y[i] - f(x[i]))^2, i = 1..n);
S(m, b);

 

S  ist in Abhängigkeit von  m und  b zu minimieren:

gln:= {diff (S(m,b), m) = 0, diff (S(m,b), b) = 0}:
gln[1];
gln[2];

 

Die Lösungen der Gleichungen  gln[1]  und  gln[2]:

lgn:= solve (gln, {m, b}):
lgn[1];
lgn[2];

n:= nops(M);
for j to n do
   x[j]:= M[j,1]:
   y[j]:= M[j,2]:
od:

n := 12

lgn: assign (lgn):
m:= evalf (m, 4);
b:= evalf (b, 4);

m := -.3555
b := 1.136

f(x):= m*x + b;

f(x) := -.3555*x+1.136

Punkte:= plot ({seq (M[i], i = 1..n)}, x = 2..4,
               style = point, symbol = cross,
               labels = [x, y]):
Gerade:= plot ([f(x)], x = 2..4, style = line,
               color = blue):
display ([Punkte, Gerade]);

[Maple Plot]

Copyright

Valid HTML 4.01 Transitional

|  Home  |  Back  |  Top  |