# FILTERING , Low pass, band pass, butterworth, ... Matlab?

Hello,
I want to implement a low pass filter, high pass and so on.
I can’t find nodes that are capable of doing so.
I tried to do so using the Matlab Snippet but it doesn’t work since I am unable to place the script and make it work.

How can I implement filters ? Or how can I just use a maltab script inside KNIME ? i.e. I don’t want to exit KNIME, run a script and then come back to KNIME.

1 Like

Hi,

You can use the Row Filter node and Rule-based Row Filter node to pass and block (include and exclude) based on a frequency threshold:

If you want to pass based on a frequency threshold and modify the higher/lower frequency values you can use the Rule Engine node (to a constant frequency or to some already calculated value) and the Math Formula or the Column Expressions nodes (to a formulated output frequency).

For example, in the math formula node you can use `if(condition, true value, false value)` function. Where the true and false values can be some formulas or constants.

1 Like

so if I understand correctly, I will need to transform the data into frequency domain, then use the simple filter to remove or keep the data that I want ?
Moving into the frequency domain is done using the FFT node?

I think you don’t need to transform anything if you know the rule for filtering on current values.
For example, if you have a column named “X” and you want to keep all the records for which the “X” column value is higher than some threshold and remove all the other records from the table, then you can use Row Filter node and the range checking option (the image in my first reply) with the threshold value for lower bound and select “Include rows by attribute value”.

You can also share some sample data and tell me what your desired output is, then it will be much easier for me to help you.

1 Like

I have a signal, which is amplitude vs. time.
I want to pass it through a low pass, band pass, high pass which are frequency filters.
Then I have to pass it through FFT and then Row filter by attribute value ?

All solutions by armingrudd are pretty on point and I agree with him that having some sample data would be helpful.

I just thought about another possibility I would like to add: you could use some Python snippets inside KNIME to do the filtering. There are some pretty complete signal processing libraries you could use that have a good variety of filters (including Butterworth). You could install the python extension and you could do your preprocessing all inside KNIME in the end.

Let me know if this was helpful and if you have any other questions/ideas

Cheers,
Ana

1 Like

This is my signal.
I know the sampling rate.
I want as an output to have the output to be amplitude vs. frequency i.e. the FFT of the signal.
Then I would like to pass it through the filters mentioned.
I will check the Pythone Libraries.

Thank you

Read the node description for FFT. I think you need to use the Window Slider node before the FFT node.

In addition to the ideas suggested above, there is also the Matlab Snippet node, if you already have Matlab installed on your machine. You’ll need to install the KNIME Matlab Scripting Extension to get it.

2 Likes

I have another suggestion:
Calculate the frequency by finding the peaks and then filter the records based on the calculated frequency. Does it make sense? If yes, let me know the sampling rate and I will provide you with a workflow to do that for you.

1 Like

I am trying to use this snippet, but I am always having an error.

could you give me an example of how to use this since the templates are really not helpful.

If possible a simple example of how to use the decimate fn and how to build a filter and pass the signal through.
I have been trying for the past couple of days and still having problems.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.