/* TO DISPLAY A GAUSSIAN FUNCTION AS USED IN NEURAL RADIAL BASIS NETWORKS Author Robert John Morton YE572246C December 1997 tab = 3 spaces */ #include #include #include double Xscale = 80, Yscale = 80; int Xbias = 300, Ybias = 300; void ShowCurve(double x, double y) { short xx = x * Xscale, yy = y * Yscale; _setpixel(Xbias + xx, Ybias - yy); } ShowScale(double x1, double y1, double x2, double y2) { short x, y; _moveto(x = x1 * Xscale, y = y1 * Yscale); _lineto(x = x2 * Xscale, y = y2 * Yscale); } main() { double x; _setvideomode(_VRES16COLOR); //VGA 640 by 480 pixels square _setcolor(15); //bright white pixels for (x = -3; x < 3; x += .01) ShowCurve(x, 3 * exp(-(x * x))); _settextposition(25,1); //for PWB termination message printf("GAUSSIAN FUNCTION used in neural radial basis networks.\n"); printf("x ranges from -3 to +3 and y = 3 * exp( -(x * x) )\n"); printf("Press any key to quit."); while(!kbhit()); _setvideomode(_TEXTC80); //reset to normal text video }