File:  [LON-CAPA] / loncom / homework / templates / Plot_data.problem
Revision 1.4: download - view: text, annotated - select for diffs
Mon Oct 29 16:21:07 2007 UTC (16 years, 6 months ago) by www
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_99_1, version_2_5_99_0, bz5969, HEAD, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox
People did not understand the other template since in fact it was not a problem.

    1: <problem>
    2: 
    3: <script type="loncapa/perl">
    4: $amplitude = &random(1,4,0.5);
    5: $x_min = -5;
    6: $x_max =  5;
    7: for ($x=$x_min;$x<=$x_max;$x=$x+0.05) {
    8:    push(@X,$x);
    9:    push(@Y,$amplitude*sin($x));
   10: }
   11: </script>
   12: 
   13: <gnuplot width="300" transparent="off" samples="100" grid="on" font="9" bgcolor="xffffff" height="300" align="left" fgcolor="x000000" border="on" plottype="Cartesian" >
   14:     <axis xmin="$x_min" ymin="-5" xmax="$x_max" ymax="5" color="x000000" />
   15:     <xlabel>Label X</xlabel>
   16:     <ylabel>Label Y</ylabel>
   17:     <curve linestyle="linespoints" name="My Plot" pointtype="0" color="x000000">
   18:         <data>@X</data>
   19:         <data>@Y</data>
   20:     </curve>
   21: </gnuplot>
   22: 
   23: <startouttext />What is the amplitude of this function?<endouttext />
   24: 
   25: <numericalresponse answer="$amplitude" format="2s">
   26:     <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="5%" />
   27:     
   28:     <textline readonly="no" />
   29: 
   30: </numericalresponse>
   31: </problem>
   32: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>