; File: sinxox.pro ; Author: Erik Brisson ; Plot of sin(x)/x ; Sample the function to get arrays of data to plot xmin = -10.0 xmax = 10.0 nsamples = 10*fix(xmax-xmin) + 1 x = fltarr(nsamples) y = fltarr(nsamples) for i=0, (nsamples-1) do begin x(i) = xmin + i*((xmax-xmin)/float(nsamples-1)) if (abs(x(i)) lt 0.0001) then begin y(i) = 1 endif else begin y(i) = sin(x(i))/x(i); endelse print, x(i), y(i) endfor ; Set up some specific stuff for the graphics system DEVICE, DECOMPOSED=0 LOADCT, 5 PRE_PCOLOR = !P.COLOR !P.COLOR=0 ; Do the plot (first everything in black, then overwrite the plot in red) plot, x, y, background=255 oplot, color=100, x, y oplot, color=100, [5.0, 5.7], [0.6, 0.6] xyouts, 6.0, 0.595, 'sin(x)/x' end