Hi, I am trying to use the filt(f, x[, si])
function from the DSP.jl module.
My raw data looks like this:
On this data I apply a lowpass filter:
df.data_raw # my raw data
w0 = 1/120 # cutoff frequency
df.data_lp= filt(digitalfilter(Lowpass(w0, fs=1/5), Butterworth(4)), df.data_raw )
The filtered data now looks like this:
Now my problem is that the filter assumes a step between the beginning and the first value of my data_raw
vector. This results in a slowly rising line right in the beginning of the filtered data. I have tried using the si
argument to define the initial filter value. Unfortunately it resulted in an error:
w0 = 1/120
df.data_lp = filt(digitalfilter(Lowpass(w0, fs=1/5), Butterworth(4)), df.data_raw, [df.data_raw[1]])
MethodError: no method matching filt(::DSP.Filters.ZeroPoleGain{Complex{Float64},Complex{Float64},Float64}, ::Array{Float64,1}, ::Array{Float64,1})
Closest candidates are:
filt(!Matched::Union{Number, AbstractArray{T,1} where T}, ::Union{Number, AbstractArray{T,1} where T}, ::AbstractArray{T,N} where N) where T at C:\Users\roble\.julia\packages\DSP\q9iEF\src\dspbase.jl:16
filt(!Matched::Union{Number, AbstractArray{T,1} where T}, ::Union{Number, AbstractArray{T,1} where T}, ::AbstractArray{T,N} where N, !Matched::AbstractArray{S,N} where N) where {T, S} at C:\Users\roble\.julia\packages\DSP\q9iEF\src\dspbase.jl:16
filt(!Matched::DSP.Filters.PolynomialRatio, ::Any, ::Any) at C:\Users\roble\.julia\packages\DSP\q9iEF\src\Filters\filt.jl:35
...
Does anyone know how to correctly use the filt
function to achieve this?
Many thanks in advance!