MATLAB Answers

How to apply bandpass filter to a single data type?

3 views (last 30 days)
afaq noor
afaq noor on 19 Sep 2020
Commented: Star Strider on 20 Sep 2020
We have recorded signals but when i load the signal into matlab, the data type is single. I want to apply bandpass filter and notch filter to these single data type signals. I have applied both the filters to the signals after converting them to double but it alters the results. Thats why i was curious if we can use band pass and notch filters on single data types.

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 19 Sep 2020
Yes. You can use single.
See the documentation section for x . This specifically refers to the Signal Processing Toolbox bandpass documentation, however it applies to all the related functions.
I do not understand how converting them to double would alter the results, however I do not have your signals to experiment with. If you are using something other than the Signal Processing Toolbox, it would be helpful to know that.

  10 Comments

Show 7 older comments
Star Strider
Star Strider on 19 Sep 2020
I cannot comment on the applicability of that paper (saved to my clip file) with respect to what you are doing. I doubt that eliminating line/mains frequency interference would have any specific effect on it, however bandpass filtering the data first certainly could. I do not see that the paper mentions filtering the signal.
I was not previously aware of that paper or its approach to EMG signal classification, since I have not done any EMG work in decades. The only classifiers I ever used were LDA (and only later some nonlinear classifiers on occasion), and only then with short-time Fourier transform (STFT, such as provided in the spectrogram function), and not on the signals themselves in the time domain.
I woud apply the bandstop filter only if a Fourier transform of the original signal demonstrates significant 50 Hz energy (something that appropriate instrumentation and a reference electrode with difference amplifiers could mitigate if not eliminate). I would not use bandpass (or other frequency-selective) filters at all, unless the same Fourier transform analysis demonstrated significant high-frequency noise, above the usual spectrum of the signals you are studying, and if your signals have a significant d-c offset. Most physiological signals have bandwidths of 500 Hz or less, so a 1 kHz sampling frequency should work. A 2 kHz sampling frequency (such as the paper uses) is appropriate, however it could result in unnecessarily large signal records. That is simply a choice you will need to make.
afaq noor
afaq noor on 20 Sep 2020
Thanks a lot for your detailed reply, i clearly understand your point, i have analysed the signal , the portion i attached is a minor portion of the signal. However there are some minor disturbances from 48-52 Hz as i have analysed the signal using signal analyser. And i am using bandpass because the useful contents of EMG signals lies between 20-100 Hz (From Litrature). I am just unsable to understand how could frequency filtering affect the data in such a way.
Star Strider
Star Strider on 20 Sep 2020
As always, my pleasure!
Filters by definition remove signal energy, so the waveform will change after the filter is applied. The change depends on the filter characteristics.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!