In C syntax, the right hand side of the equation is:
0.39894228 * exp(-0.5 * x * x)For the purposes of this program, the x-axis will run down the page and the y-axis will run across. For the basic assignment, write a program which plots an asterisk * for each point between the x-axis and the bell curve. Each line down the page of the plot should represent a distance of 0.1 along x-axis; and each space across the page of the plot should represent a distance of 0.01 along the y-axis. Plot the bell curve for x = -2.5 to x = 2.5. You may assume that the bell curve does not exceed 0.4 in this range. You should also print out the tick marks and labels for the x and y axes. (See the example below.) The basic assignment is worth 85% of the project grade. For the full assignment, your program should ask the user for several values relating to the plot. You should ask the user for the region of the graph to be plotted as well as the scale of the x and y axes. For example, in the second example below, the user asked for the graph to be plotted between x = 0.0 and x = 2.0. The x axis is scaled so that each line represents 0.1 and the y axis is scaled so that each space represents 0.008. Because of space limitations, you should plot only 50 spaces along the y-axis. For the full assignment, print out labels for every 10 spaces along the y-axis and every 5 lines along the x-axis.
#includeAlso, you must add -lm to the end of cc201 command:
% cc201 project2.c -lm
0 0.100000 0.200000 0.300000 0.400000 0.500000 |_________|_________|_________|_________|_________| -2.5|* |** |** |*** |**** -2|***** |****** |******* |********* |*********** -1.5|************ |************** |***************** |******************* |********************* -1|************************ |************************** |**************************** |******************************* |********************************* -0.5|*********************************** |************************************ |************************************** |*************************************** |*************************************** 1.082e-15|*************************************** |*************************************** |*************************************** |************************************** |************************************ 0.5|*********************************** |********************************* |******************************* |**************************** |************************** 1|************************ |********************* |******************* |***************** |************** 1.5|************ |*********** |********* |******* |****** 2|***** |**** |*** |** |** 2.5|*
Low x value: 0.0 High x value: 2.0 x increment size: 0.1 y increment size: 0.008 0 0.080000 0.160000 0.240000 0.320000 0.400000 |_________|_________|_________|_________|_________| 0|************************************************* |************************************************* |************************************************ |*********************************************** |********************************************** 0.5|******************************************** |***************************************** |*************************************** |************************************ |********************************* 1|****************************** |*************************** |************************ |********************* |****************** 1.5|**************** |************* |*********** |********* |******** 2|******
% cat proj2.c typescript | mail chang@gl.umbc.eduPlease turn in only one copy of your project. If you finish early, check your answer and turn in the final copy.