BLK_CON

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The BLK_CON function computes a "fast convolution" of a digital signal and an impulse-response sequence. It returns the filtered signal.

This routine is written in the IDL language. Its source code can be found in the file blk_con.pro in the lib subdirectory of the IDL distribution.

Syntax

Result = BLK_CON( Filter, Signal [, B_LENGTH=scalar] [, /DOUBLE] )

Return Value

This function returns a vector with the same length as Signal. If either of the input arguments are double-precision or the DOUBLE keyword is set, the result is double-precision, otherwise the result is single-precision.

Arguments

Filter

A P-element floating-point vector containing the impulse-response sequence of the digital filter.

Signal

An n-element floating-point vector containing the discrete signal samples.

Keywords

B_LENGTH

A scalar specifying the block length of the subdivided signal segments. If this parameter is not specified, a near-optimal value is chosen by the algorithm based upon the length P of the impulse-response sequence. If P is a value less than 11 or greater than 377, then B_LENGTH must be specified.

B_LENGTH must be greater than the filter length, P, and less than the number of signal samples.

DOUBLE

Set this keyword to force the computation to be done using double-precision arithmetic.

Examples

; Create a filter of length P = 32:
filter = REPLICATE(1.0,32) ;Set all points to 1.0
filter(2*INDGEN(16)) = 0.5 ;Set even points to 0.5

; Create a sampled signal with random noise:
signal = SIN((FINDGEN(1000)/35.0)^2.5)
noise = (RANDOMU(SEED,1000)-.5)/2.
signal = signal + noise

; Convolve the filter and signal using block convolution:
result = BLK_CON(filter, signal)

; Print the raw and filtered signals

; Draw both plots to the same window
!p.MULTI = [0,2,0,0,0]
; Widen the window to comfortably fit two plots
WINDOW, 2, XSIZE=(960), $
YSIZE=(480)

PLOT, signal, TITLE='Signal + Noise'
PLOT, result, TITLE='Convolved Filter and Signal'

; Reset the system variable to one plot per page
!p.MULTI=0

Version History

Pre 4.0

Introduced

See Also

CONVOL