CorrelationFract32
Overview
Computes the zero-lag cross correlation
Discussion
This module calculates the cross correlation of 2 single-channel inputs. The calcuation is block based and the module outputs a single value which is the correlation for the block of input data. The cross correlation is without time lag. The formula is:
<in1, in2>
-----------------------------------------------
norm(in1,NORM_TYPE) * norm(in2,NORM_TYPE)
NORM_TYPE (Tunable parameter) chooses between L1 norm or L2 norm. L1 norm is the Manhattan distance of a vector. L2 norm (Euclidean) is the Pythagorean distance of a vector.
Module Pack
Advanced
ClassID
classID = 1245
Type Definition
typedef struct _ModuleCorrelationFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 norm; // Type of norm: L1_norm=1, L2_norm=2
} ModuleCorrelationFract32Class;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| norm | int | parameter | 0 | 2 | 1:2 |
Pins
Input Pins
| Name | in1 |
| Description | Signal input 1 |
| Data type | fract32 |
| Channel range | 1 |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
| Name | in2 |
| Description | Signal input 2 |
| Data type | fract32 |
| Channel range | 1 |
| Block size range | Unrestricted |
| Sample rate range | Unrestricted |
| Complex support | Real |
Output Pins
| Name | out |
| Description | xcorrelation value |
| Data Type | fract32 |
Matlab Usage
File Name: correlation_fract32_module.m
M=correlation_fract32_module(NAME)
This module calculates the cross correlation of 2 single-channel inputs.
The cross correlation is without time lag.
The formula is:
<in1, in2>
-----------------------------------------------
norm(in1,NORM_TYPE) * norm(in2,NORM_TYPE)
NORM_TYPE (Tunable parameter) chooses between L1 norm or L2 norm.
L1 norm is the 'manhattan' distance of a vector
L2 norm (Euclidean) is the Pythagorean distance of a vector
Arguments:
NAME - name of the module.
Copyright (c) 2026 DSP Concepts, Inc.