University of Groningenfounded in 1614  -  top 100 university

# Data approximation

/*  This program demonstrates data approximation upon data
of the use of Frisian stallions in 1952 - 1982, taken from
"Het Friese hengstenboek" (E. Dijkstra, Kollum).
remaining data from Auke Meetsma ...

The graph shows the decline of the Frisian working-horse
and the resurrection as a coach-horse.
*/

#include <stdio.h>
#include <math.h>
#include "komplot.h"

int main()
{
float x[45], xk [4];
float y[] = {1187,1452,1325,1154,1041,1261,1316,1260,1296,
1138, 1002,1033,877,804,729,622,596,522,473,411,
411,446,608,760,735,715,747,823,912,981,
1019,1128,
1210, 1308, 1407, 1464, 1586, 1830, 2165, 2389,
2672, 4433, 3736, 4088, 4401 };
int i;

frame_style("cbs");

/* define font = Helvetica (default Times-Roman)*/
ps_define_font("A", "Helvetica");

scale_dimensions(0.8);
tick_distances(1.5, 1.1);
scale_annotations(1.5);
format_x_axisnumbers(0,0);
format_y_axisnumbers(0,0);
frame(13.5, 1950, 1995, 9.9, 0, 4500, "Year", "",
"Nr. of mountings of Frisian stallions");

for(i=1 ; i < 46 ; i++)
x[i-1]=1950 + i;

/* line width=0.05 cm, grayvalue = 0 (black) */
ps_graph_attributes(0.05, 0);
/* mark points with filled circle, isym=17 */
markers(" ", 45, x, y, 17);
/* fit a parabola through 5 successive points, 1 times
*/
local_parabola_ap("local parabola fitting ", 45,x, y, 1);

xk[0]=1958;
xk[1]=1965;
xk[2]=1972;
xk[3]=1990;
line_style_nr(1);

/* skip KOMPLOT warning ...*/
spline_var_knots_ap("spline with variable knots", 45,x,y,4,xk);

printf (" >>>>>> This program generated KOMPLOT.TMP\n");
printf (" >>>>>> KOMPLOT.TMP is inputfile for komplot\n");

/*
komplot(40,"da.ps");
system("xv da.ps");
*/
return 0;

}