## Digital Signals

A one-dimensional digital signal is a sequence of data, represented as a vector in an array-oriented language like IDL. The term digital actually describes two different properties:

1. The signal is defined only at discrete points in time as a result of sampling, or because the instrument which measured the signal is inherently discrete-time in nature. Usually, the time interval between measurements is constant.
2. The signal can take on only discrete values.

In this discussion, we assume that the signal is sampled at a time interval. The concepts and techniques presented here apply equally well to any type of signal-the independent variable may represent time, space, or any abstract quantity.

The following IDL commands create a simulated digital signal u(k), sampled at an interval `delt`. This simulated signal will be used in examples throughout this section. The simulated signal contains 1024 time samples, with a sampling interval of 0.02 seconds. The signal contains a DC component and components at 2.8, 6.5, and 11.0 cycles per second.

Enter the following commands at the IDL prompt to create the simulated signal:

```N = 1024
delt = 0.02
u = -0.3 \$
+ 1.0 * SIN(2 * !PI * 2.8 * delt * FINDGEN(N)) \$
+ 1.0 * SIN(2 * !PI * 6.25 * delt * FINDGEN(N)) \$
+ 1.0 * SIN(2 * !PI * 11.0 * delt * FINDGEN(N))
```

Alternately, you can run the following batch file to create the signal:

```@sigprc01
```

See Running the Example Code if IDL does not find the batch file.

Because the signal is digital, the conventional way to display it is with a histogram (or step) plot. To create a histogram plot, set the PSYM keyword to the PLOT routine equal to 10. A section of the example signal u(k) is plotted in the figure below.

 Note
When the number of sampled data points is large, the steps in the histogram plot are too small to see. In such cases you should not plot in histogram mode.

Enter the following commands at the IDL prompt to create the plot:

```; Compute time data sequence u.
@sigprc01
; Vector of discrete times:
t = delt * FINDGEN(N)
; Beginning of plot time range:
t1 = 1.0
; End of plot time range:
t2 = 2.0
PLOT, t+delt/2, u, PSYM=10, XRANGE=[t1,t2], \$
XTITLE='time in seconds', YTITLE='amplitude', \$
TITLE='Portion of Sampled Time Signal u(k)'
```

Alternately, you can run the following batch file to create the plot:

```@sigprc02
```

See Running the Example Code if IDL does not find the batch file.