sosfilt
Builtin index · Signal processing
result = sosfilt(filt, x)
Input: filt, x · Output: result
What it is
filt: a Model (kind "filter", field sos or b); x: a length-N vector or Signal.
Overloads
x can be vector or Signal.
2 forms. Each carries its own inputs, outputs and worked example — pick the tab for the one you are calling.
| Code | Input | Output | Description |
result = sosfilt(filt, x) | filt Modelfilt a Model with a sos field (butter/ellip/cheby1/cheby2).x vector or SignalRuns x through the biquad cascade section by section. | Signal Signalkeeping x's own Fs on the way out, when x is a Signalb —FIR | — |
Examples
Written for this form and run by the build -- the output below is what the engine actually produced.
fs = 100
t = (0 to 19) / fs
x = sin(2*pi*10*t)
iir = butter(2, "low", 20, fs)
y_iir = sosfilt(iir, x)
print("IIR-filtered length: {length(y_iir)}") # IIR-filtered length: 20
output
IIR-filtered length: 20
| Code | Input | Output | Description |
result = sosfilt(filt, x) | filt Modelfilt a Model with a b field (fir1/firls).x vector or SignalRuns x through conv(x, b, "full"), truncated back to length(x) — no biquad state at all. | Signal Signalkeeping x's own Fs on the way out, when x is a Signalb —FIR | — |
Examples
Written for this form and run by the build -- the output below is what the engine actually produced.
fs = 100
t = (0 to 19) / fs
x = sin(2*pi*10*t)
fir = fir1(6, 20, kind="low", fs=fs)
y_fir = sosfilt(fir, x)
print("FIR-filtered length: {length(y_fir)}") # FIR-filtered length: 20
output
FIR-filtered length: 20