Reputation: 332
I am trying to the equivalent of MATLAB's filter
function in Swift code. MATLAB's filter function is defined as follows:
filter(b,a,x)
y = filter(b,a,x) filters the input data x using a rational transfer function defined by the numerator and denominator coefficients b and a.
If a(1) is not equal to 1, then filter normalizes the filter coefficients by a(1). Therefore, a(1) must be nonzero.
If x is a vector, then filter returns the filtered data as a vector of the same size as x.
If x is a matrix, then filter acts along the first dimension and returns the filtered data for each column.
If x is a multidimensional array, then filter acts along the first array dimension whose size does not equal 1.
I realize that Python has the numpy module and associated functions to help implement this function. However, I am not aware of a similar toolset within the context of Swift. I really would like to avoid the logic of implementing a rational-transfer function, so I was wondering if there was an existing Swift module or reference for this. I could also translate a bare-bones implementation written in Python into Swift.
Does filter
exist in Swift?
Upvotes: 1
Views: 552