filt!
.. filt!(out, b, a, x, [si])
Same as :func:`filt` but writes the result into the ``out`` argument,
which may alias the input ``x`` to modify it in-place.
Examples
In the Julia programming language, the function filt!(out, b, a, x, [si])
is similar to filt
, but it writes the result into the out
argument, which may alias the input x
to modify it in-place.
julia> out = similar(x);
julia> filt!(out, b, a, x)
This function performs filtering on the input signal x
using the filter coefficients provided by b
and a
, and stores the result in the out
array.
Common examples of its use:
-
Filter an array in-place:
julia> x = [1.0, 2.0, 3.0, 4.0, 5.0]; julia> b = [0.5, 0.5]; julia> a = [1.0, -0.5]; julia> out = similar(x); julia> filt!(out, b, a, x) 5-element Array{Float64,1}: 0.5 1.5 2.75 4.125 5.28125
This example filters the array
x
in-place using the filter coefficientsb
anda
, and stores the filtered result in theout
array. - Modify an existing array with filtering:
julia> x = [0.2, 0.6, 0.9, 1.2, 0.7]; julia> b = [1.0, -1.0]; julia> a = [1.0, 0.5]; julia> filt!(x, b, a, x) 5-element Array{Float64,1}: 0.2 0.4 0.3 0.5 0.35
In this example, the
x
array is modified in-place with the filtered result using the filter coefficientsb
anda
.
Note: The optional si
argument is not shown in the examples as its usage depends on specific use cases.
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.