load(lsquares)$ fpprintprec:5$

Sinus-Regression am Beispiel der Temperaturwerte Wiens

daten:matrix([0.5,-1.4],[1.5,0.4],[2.5,4.7],[3.5,10.3],[4.5,14.8],[5.5,18.1],
              [6.5,19.9],[7.5,19.3],[8.5,15.6],[9.5,9.8],[10.5,4.8],[11.5,1])$

sinreg:lsquares_estimates(daten,[x,y],y=a*sin(b*x+c)+d,[a,b,c,d]),numer;

sinterm:a*sin(b*x+c)+d,sinreg;

define(f(x),sinterm)$

daten_list:makelist(daten[i],i,1,matrix_size(daten)[1])$

wxplot2d([f,[discrete,daten_list]],
  [x,-2,15],[y,-5,25],[style,[lines,1,1],[points,2,2,1]]);