0
$\begingroup$

I want to isolate a reflection part of a signal which I've transformed from Frequency to Time-Domain (see Picture). So far, I've tried to create a Hamming-Window with the specific window-width for the red marked part of the signal. Then I created a signal with zeros (gate), which has the exact same length as the time-domain signal. Next, I multiply the time-domain-signal with the gate.

window_width = abs(stop_idx - start_idx) + 1;
window = hamming(window_width);
gate = zeros(1, length(time_vec));

gate(start_idx:stop_idx) = window;

signal_td_g = signal_td' .* gate;

signal_fd_g = fft(ifftshift(signal_td_g));

Am I doing this right? Or is there a more sophisticated way of filtering the signal?

Signal in time domain

$\endgroup$
5
  • 1
    $\begingroup$ Welcome! It's not quite clear to me what you would to do here: get rid of the reflection or isolate it ? $\endgroup$
    – Hilmar
    Commented Feb 4 at 16:37
  • $\begingroup$ Hey Hilmar! I want to isolate the reflection with a filter, which is called gating. Then I want to transform the isolated reflection back to the frequency domain. $\endgroup$
    – Anne-Mary
    Commented Feb 4 at 16:58
  • $\begingroup$ I believe your question is not very clear, like Hilmar mentioned. Is there a reason you use a Hamming window to try and isolate the reflection? Otherwise it seems you are doing quite OK. Other “more sophisticated” method (not sure they are sophisticated, but it does seem more complicated) would be to find peaks in the signal, pick all of them that are below a certain threshold and keep the “area” around them. The threshold and the size of the area around the peaks to keep will be parameters you’ll have to decide on. Finally, this may work OK for this case but it does not generalise well. $\endgroup$
    – ZaellixA
    Commented Feb 4 at 17:38
  • $\begingroup$ If there is a reflection it means the signal was copied with different delays calculate the auto correlation (xcorr in matlab) and it will give you some idea of the delay and the amplitude of each reflection. If you have a sufficiently high sample rate you could just subtract the delayed copy. If not you might want to implement an interpolated version of this idea ( with fractional sample interval delay ), or if you don't care too much about efficiency, upsampling before doing it. $\endgroup$
    – Bob
    Commented Feb 4 at 18:31
  • $\begingroup$ It appears that you aren't windowing the frequency domain waveform before transforming to the time domain? This will reduce the time leakage you see from the main pulses to the reflection which will help improve your isolation. $\endgroup$ Commented Mar 6 at 4:25

2 Answers 2

0
$\begingroup$

Here is what I would do:

  1. The reflection is "riding" on top of what looks like an exponential decay
  2. I would try to roughly model this decay either exponentially or as a low-order polynomial (whichever looks better)
  3. Subtract the model from the data
  4. Gate it with a rectangular window

This may not may not meet your needs, but this really depends on your specific requirements and what you want to do with the result.

$\endgroup$
0
$\begingroup$

Consider what we would do if we swapped "time domain" and "frequency domain". What we would optimally do in that case is what the OP could do here in the goal of finding a "more sophisticated technique". Specifically, if we need to isolate part of the signal in the frequency domain over some range of higher frequencies, we convolve the signal in the time domain with and FIR or IIR bandpass filter designed to optimally select the frequencies of interest while reject other frequencies further away.

If the OP started with a waveform in the frequency domain, then stay in the frequency domain and design a bandpass filter as if the waveform was in the time domain -- my favored technique is to use least squares for an FIR filter design (firls in MATLAB, Octave or Python scipy.signal). Determine those coefficients and "filter" the frequency domain waveform by convolving the waveform with the coefficients for that filter. The result will be shifted in frequency (the frequency domain equivalent of a time delay) which can either be shifted back by truncating the initial values, or if post-processing, use filtfilt to filter with a non-causal "zero-phase" filter which will have no offset.

Further consider with the OP's technique the similarity to the inferior "frequency sampling" technique for FIR filter design (inferior for a simple bandpass solution such as this). With the frequency sampling technique, we take the FFT of the signal and select the bins corresponding to the desired frequencies (which is the "gating described"). This is an inferior technique due to time domain aliasing and (without additional processing techniques) results in more passband ripple and less stopband rejection than we could get with the firls technique described here, given the same filter complexity.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.