In the case of a previously filtered signal, what methods can be employed to identify its filter characteristics?

41 views (last 30 days)
I'm dealing with signals that have already been subjected to a filter. My goal is to create a filter that mimics the characteristics of the original filter without knowledge of its design specifications. Right now, I have a filtered signal and want to apply it to a raw signal to closely emulate the features of the filtered signal. Any insights or advice on methods to accomplish this would be greatly appreciated.
  1 Comment
Les Beckham
Les Beckham on 16 Nov 2023
If you have a sample of the raw, unfiltered, data and the filtered data for the same test, it might be possible. If not, you are probably just going to have to experiment to get filtered data that "looks good" to you.
Can you provide sample raw and filtered data files? Use the paperclip icon to attach to your question or a comment.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 16 Nov 2023
If you have the original signal as well (before filtering), you can approximate the filter transfer function by taking the Fourier transform of the filtered and unfiltered signals and dividing them element-wise:
TrFn = fft(filtered_signal) ./ fft(original_signal);
then plot that result: That might go something like this (assuming column vectors for everything):
Fs = sampling_frequency;
Fn = Fs/2;
L = numel(original_signal);
NFFT = 2^nextpow2(L);
FToriginal = fft(original_signal).*hann(L), NFFT)/L;
FTfiltered = fft(filtered_signal).*hann(L), NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
TrFn = FTfiltered ./ FToriginal;
figure
plot(FV, abs(TrFn))
grid
xlabel('Frequency')
ylabel('Magnitude')
title('Filter Transfer Function')
The cutoff frequencies will be the points at which the magnitude is one-half the peak magnitude that is assumed to be 1. A more precise way to calculate this would be to use the interp1 function.
If you only have the filtered signal, plot its Fourier transform alone and then estimate the cutoff frequencies as the frequency at one-half the maximum magnitude.
It would be easier with the acrtual data, however this sort of approach should work.
  2 Comments
G
G on 16 Nov 2023
Unfortunately, I only possess the filtered signal by itself. The plan is to apply whatever filter was used to create this signal onto a raw signal from the same source. The only information I have about the filtered signal data is that it underwent bandpass filtering. Although my initial inclination was to explore alternatives outside of an FFT of the filtered signal, it seems I may eventually have to take that route. Thank you for your valueable input.
Star Strider
Star Strider on 16 Nov 2023
As always, my pleasure!
One way to closely approximate the pasband of the original filter is to use the firls function. FIR filters have the disadvantage of being relatively long (orders can be in the hundreds), and so require long signals to filter.
It might otherwise be possible to approximate the signal spectrum with an IIR filter by visually matching the frequency spectrum with known filter types. Using the designfilt function (with its many parameters) might make this easier. If you only want to match the passbands and are not concerned about exactly matching the filter characteristids, an elliptic filter is likely the most efficient IIR filter design.

Sign in to comment.

More Answers (1)

William Rose
William Rose on 16 Nov 2023
If you only have the filtered signal, and not the original, then you are out pf luck, unless you know, or are willing to assume, some things about the original signal.
If you have both signals, then you use them to compute the transfer function, in the frequency domain, between them. You will inspect the magnitude of the transfer function to see if it is low pass, high pass, band pass, etc., You will note the approximate cutoff frequency/frequencies and you will estimate the filter order from the steepness of the rolloff. You will inspect the phase of the transfer function to decide if it is causal or not, and to estimate if there is a pure delay in addition to other features, and to confirm or revise your estimate of the filter order.
Use tfestimate() from the SIgnal Processing Toolbox to estimate the transfer function.
  4 Comments
G
G on 17 Nov 2023
This approach is intruiging. It seems that its primary applications lie in reconstructing original images from filtered ones and generic artifact reduction in biosignals. I'll definitely explore the literature and give this a try. Thanks a bunch for bringing it to my attention!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!