|
Getting Started with IDL: Signal Processing with IDL |
|
First, we need to create a dataset to display.
ORIGINAL:ORIGINAL=SIN((FINDGEN(200)/35)^2.5)
The FINDGEN function returns a floating-point array in which each element holds the value of its subscript, giving us the increasing "time" values upon which the sinewave is based. The sine function of each "time" value divided by 35 and raised to the 2.5 power is stored in an element of the variable ORIGINAL.
PLOT, ORIGINAL
NOISY=ORIGINAL+((RANDOMU(SEED,200)-.5)/ 2)
PLOT, NOISY
The RANDOMU function creates an array of uniformly distributed random values. The original dataset plus the noise is stored in a new variable called NOISY. This dataset looks more like real-world test data.
PLOT, ORIGINAL, XTITLE="Time",YTITLE="Amplitude",THICK=3
PLOT, NOISY, /OVERPLOT
The XTITLE and YTITLE keywords are used to create the X and Y axis titles. The OPLOT command plots the NOISY dataset over the existing plot of ORIGINAL without erasing. Setting the THICK keyword causes the default line thickness to be multiplied by the value assigned to THICK, so you can differentiate between the data. This result can be seen in the following figure.
IDL Online Help (March 06, 2007)