#include #include /* ./a.out |graph -T X -x 0 1024 */ int n; double dx, x, y, width,center, height; double edge(double x, double center, double width, double height); double peak(double x, double center, double width, double height); main(){ center=8.0; width=1.0; height=1.0; dx=0.2; for(n=0;n<100;n++){ x=(double)n*dx; printf("%f\t%f\n", 51.0*(x-0.125*dx),0.0); printf("%f\t%f\n", 51.0*x,0.0); printf("%f\t%f\n", 51.0*x, peak(x,center, width,height) +edge(x, 2.0, 2.25, 3.0)); printf("%f\t%f\n", 51.0*x,0.0); printf("%f\t%f\n",51.0*(x+0.125*dx),0.0); } } double peak(double x, double center, double width, double height){ return( (height*center)/((x-center)*(x-center)+width*width)); } double edge(double x, double center, double width, double height){ return( height*(1.0-tanh(width*(x-center)))); }