# TransferFunction

Advanced Analysis Library Only

AnalysisLibErrType TransferFunction (double stimulus[], double response[], int numberOfElements, double dt, double magHf[], double phaseHf[], double *df);

## Purpose

Calculates the single-sided transfer function, also known as the frequency response, from the time-domain stimulus signal and the time-domain response signal of a network under test.

TransferFunction calculates the transfer function Hf as follows:

and transforms this result to single-sided magnitude and phase.

## Parameters

Input
Name | Type | Description
stimulus | double-precision array | The time-domain signal, usually the network stimulus.
response | double-precision array | The time-domain signal, usually the network response.
numberOfElements | integer | Number of elements in the input stimulus and response arrays. Default Value: 1024.
dt | double-precision | Sampling period of the time-domain signals, usually in seconds. dt = 1/fs, where fs is the sampling frequency of the time-domain signals. Default Value: 1.0.
Output
Name | Type | Description
magHf | double-precision array | Magnitude of the averaged single-sided transfer function between the stimulus and response signals. This array must be at least numberOfElements/2 elements long.
phaseHf | double-precision array | Phase, in radians, of the averaged single-sided transfer function between the stimulus and response signals. This array must be at least numberOfElements/2 elements long.
df | double-precision | Points to the frequency interval, in Gertz, if dt is in seconds. df = 1/(numberOfElements × dt)

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.