// This macro creates a damped wave plot // using postive and negative filled plots. // // Author: Norbert Vischer close("*_", "keep"); close("*_.ijm", "keep"); left = 0; right = 4; bottom = -1.2; top = 1.2; nPoints = 150; //Create demo data xValues = newArray(nPoints); yValues1 = newArray(nPoints); yValues2 = newArray(nPoints); yValues3 = newArray(nPoints); for (p = 0; p < nPoints; p++) { x = p/nPoints * right; xValues[p] = x; a = exp(-x); yValues1[p] = a; yValues2[p] = -a; yValues3[p] = a * cos(p/5); } Plot.create("Damped Wave_", "X", "Y"); Plot.setLimits(left, right, bottom, top ); Plot.setFrameSize(600, 300 ); Plot.setColor( "#ddddff"); Plot.add("filled", xValues, yValues1); Plot.add("filled", xValues, yValues2); Plot.drawGrid; Plot.setLineWidth(2); Plot.setColor("blue"); Plot.add("line", xValues, yValues3); Plot.show;