Qu

transfer_function

Builtin index · Signal processing

result = transfer_function(input, output, [fs], [method="h1"], [nperseg=min(256,len)], [noverlap=nperseg/2], [window="hann"])

Input: input, output, fs, method, nperseg, noverlap, window · Output: result

What it is

No chapter describes this one yet. It exists -- the name comes from the interpreter's own table -- but the prose has not been written. That is a gap in the documentation, not in the engine.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = transfer_function(input, output, [fs], [method="h1"], [nperseg=min(256,len)], [noverlap=nperseg/2], [window="hann"])
input vector or Signalinput/output: equal-length real vectors or Signals recorded simultaneously.
output CVecReturns an frf model carrying the frequency response of the system taking input to output, with fields h (length-nperseg/2 + 1 CVec), freq (the matching Hz axis), coherence, method, fs and nperseg.
fs number, optionalfs (number, Hz) may instead be carried by either one, and two recordings carrying rates that disagree is an error.
method optional (default "h1")method selects the noise-weighted estimator: "h1" (default) assumes the noise is on the output and is the usual choice for a controlled excitation.
nperseg CVec, optional (default min(256,len))Returns an frf model carrying the frequency response of the system taking input to output, with fields h (length-nperseg/2 + 1 CVec), freq (the matching Hz axis), coherence, method, fs and nperseg.
noverlap optional (default nperseg/2)not documented yet
window optional (default "hann")not documented yet
h CVeclength-nperseg/2 + 1 CVec
freq —the matching Hz axis
fs numberHz
Returns an frf model carrying the frequency response of the system taking input to output, with fields h (length-nperseg/2 + 1 CVec), freq (the matching Hz axis), coherence, method, fs and nperseg. input/output: equal-length real vectors or Signals recorded simultaneously; fs (number, Hz) may instead be carried by either one, and two recordings carrying rates that disagree is an error. method selects the noise-weighted estimator: "h1" (default) assumes the noise is on the output and is the usual choice for a controlled excitation; "h2" assumes it is on the input and is the one to use at a resonance; "hv" is the geometric-mean compromise sqrt(H1*H2). All three share one phase and differ only in magnitude, in the fixed ratio |H1| = coherence * |H2|, so they agree exactly on a noiseless record. Built on welch/csd with one shared framing, so h, coherence and the axis line up bin-for-bin. Read it with H.magnitude(), H.phase(), H.coherence(), H.freq, and plot it with H.bode(). Added in v0.3.0.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

transfer_function(input, output, [fs], [method="h1"], ...) — toolkit-signal.md §11's Signal.transferFunction(input, output): the frequency response of the system taking input to output, with the coherence that says how much of the output that response actually explains. The estimator is a method= KEYWORD rather than three separate builtins. H1/H2/Hv are three answers to one question (where is the noise?), not three operations — and the names h1/h2 are already taken by the report builder's heading helpers (r.h1("Title")), so top-level h1(x, y) was never available to take. Returns a kind="frf" handle rather than a bare CVec because §0's whole thesis is that the axis travels with the data: H.freq is in Hz and reads exactly like Spectrum's own .freq, and H.magnitude()/.phase()/.coherence() work through the ordinary recv.method() sugar.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.