# LabVIEW

cancel
Showing results for
Did you mean:

## Filter sine with square envelope

Hi!

I have generated a sine signal with square envelope (signal for echolocation). My task is to add White Gaussian Noise, which I already did and then to filter the noise.

How can I filter the noise with this kind of signal? I tried Bandpass IIR, but it does not completely filter the signal.

Here are signal parameters:

Sine frequency: 5kHz

Square signal period: 0,2 s.

Below signal in time domain and the spectrum without the noise:

Below signal in time domain and the spectrum with gaussian noise:

Message 1 of 7
(2,930 Views)

## Re: Filter sine with square envelope

Who said you can filter out that noise?

If the frequencies of that noise overlap the frequencies your interested in, you can't filter it out without filtering the signal out.

If you're interested in the 5 kHz signal, I think (I'm no RF expert) you can multiply the signal with e^-iwt (or something like that, I can look it up, I've done it before) to get only that exact frequency. But that block wave will introduce every frequency in the spectrum, so it might show on the output. Also, that noise might contain 5 kHz data, that will also show.

Message 2 of 7
(2,879 Views)

## Re: Filter sine with square envelope

You need to think a bit about Signal Theory here.  You have two signals, a 5 KHz sinusoid and a 5 Hz square wave.  You haven't said what your sampling frequency is (which affects the number of frequency points in your spectrum), but let's say it is 50 KHz.  Think about the expected spectrum of just the sinusoid -- pretty simple, right?  Only one frequency.  How about the spectrum of the Square Wave -- more complicated, energy spread across the spectrum.  What happens when you multiply the sinusoid and square wave?  Do you know the relationship between the spectrum of a product and the spectra of each of the product components?  [I haven't done this sort of thing recently, but I vaguely remember a convolution ...].

This is, indeed, a very messy problem.  I wonder if it could be decomposed into two sub-problems -- divide the signal into "Sinusoid + Noise" and "Noise" samples (i.e. determine the edges of the Square Wave) and determine, separately, the "Noise" spectrum and the "Signal + Noise" spectrum.  Particularly if you averaged the spectra over each half-period of the Square Wave, you might be able to make the case for subtracting the spectra (do this in phase space, of course) to get an estimate of the Signal spectrum (without the noise).

Bob Schor

Message 3 of 7
(2,871 Views)

## Re: Filter sine with square envelope

The shown case is simple.

Detect the noisy sine block (trigger RMS (rec window 1-2 times periode))

Apply tone detection on that block to get frequency,amp&phase and residual

Reconstruct signal

For radar speed measurement use heterodyne demodulation ...

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Message 4 of 7
(2,845 Views)

## Re: Filter sine with square envelope

As others have said, if you are just interested in a single frequency, you can get that out (phase & amplitude). The problem is that the echo signal might have doppler shifts, for example if the detector and object change distance (have relative movement) during measurements.

Can you attach a simplified VI with some typical data?

I assume that you graphs on the right have a logarithmic Y axis. Even with the noise, the peak is well above the noise, so what's the problem.

What data are you actually interested it? Just the edges of the square wave to get an echo delay?

Message 5 of 7
(2,839 Views)

## Re: Filter sine with square envelope

Actually, my aim is to filter the sine as well as the square signal. The input signal is an audio signal and I should implement adaptive filter for different noise levels for read audio with echolocation signal. So I am attaching the .vi with the .wav file as well.

Message 6 of 7
(2,827 Views)

## Re: Filter sine with square envelope

Your wav file signal looks very clean, but clipped ...

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Message 7 of 7
(2,816 Views)