|
|
Nichtlineare Regression

> |
with (Statistics): with (CurveFitting): with (plots): Seed:= randomize():
Warning, the name changecoords has been redefined |
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,
color = black,
symbol = cross,
labels = ["x","y"]); |
![[Maple Plot]](images-nlinregr/nlinregr2.gif)
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,
color = red):
Kurve:= plot (f(x), x = 0..4,
color = blue,
linestyle = DOT):
display ([Punkte, Kurve, Regressionskurve]); |

![[Maple Plot]](images-nlinregr/nlinregr5.gif)
|