dh-Materialien
Maple   
Übungen

Nichtlineare Regression

> restart;

> with(Statistics): with(CurveFitting): with(plots):
Seed:= randomize():
fnt:= 'font = [COURIER, 12]';

Simulation der Messung einer Größe y in Abhängigkeit von x:

> xWerte:= [seq(n/5, n = 0..20)]:
f:= x -> -x^2 + 4*x + 1;
yWerte:= map(x -> f(x) + (rand(90)() - 45)/70, xWerte):

> ScatterPlot (xWerte, yWerte, fnt,
  color  = black,
  symbol = CROSS,
  labels = ["x", "y"]);

[Maple Plot]

Finden einer Regressionskurve mit der Methode der kleinsten Quadrate:

> Punkte:= ScatterPlot(xWerte, yWerte,
  color  = black,
  symbol = CROSS,
  labels = ["x", "y"]):
y:= LeastSquares(xWerte, yWerte, x, curve = a*x^2 + b*x + c):
y;

> regr(x):= evalf(y, 3);
Regressionskurve:= plot(regr(x), x = 0..4, fnt,
  color = red):
Kurve:= plot(f(x), x = 0..4,
  color = blue,
  linestyle = DOT):
display([Punkte, Kurve, Regressionskurve]);

 [Maple Plot]