3
votes

I am trying to detect specific signals modulated at fc=75kHz with match filtering. Also, the detection is implemented in a 7 mins audio file with the sample rate of 312.5kHz (which leads to a very large amount of samples-about 135 million). This makes the processing and filtering process taking too much time and not applicable for real-time applications. Then, I decided to convert the signal to baseband equivalent model (to change the sampling frequency, hence decreases the number of samples) with the following code:

    audio = audioread(file);
    fc = 75000;
    t = (1:length(audio)).';
    y = audio*sqrt(2).*exp(-i*2*pi*fc*t);

but this doesn't work, I took the Fourier transform of both the orignial signal and the one after converting to baseband to observe the spectrum in frequency domain.

spectrum](http://i.imgur.com/SXi865J.png)![Spectrum of signal before and after converting to baseband

As you can see, the spectrum of the 75kHz signal doesn't move to the zero point.

My questions are:

  1. Is my code for converting to baseband wrong? If so, how can I convert this signal to baseband signal?
  2. Is there any other ways to significantly decrease the number of samples of this file without losing the information of 75kHz signal (I tried downsampling with sampling rate = 150kHz, but that is still too many samples)?
1
I think you need to replace t = (1:length(audio)).'; by t = (1:length(audio)).'/312500; to properly define time, accounting for the original sampling rate. Also, you may need to apply a low-pass filter after multiplication by the imaginary exponential. Perhaps a band-pass filter before the conversion would help tooLuis Mendo
@LuisMendo, one misunderstanding between the number of samples and the time scale screwed up a lot, thanks for showing me my mistake, it really helps me solve a big part of the problemHienPham

1 Answers

2
votes

As @Luis Mendo mentioned in comments, to shift the spectrum from 75kHz to 0 with a sampling rate of 312.5kHz, you would need to divide your time variable by the sampling rate:

fs = 312500;
t = (1:length(audio)).'/fs;
y = audio*sqrt(2).*exp(-i*2*pi*fc*t);

This will shift the entire input spectrum (including the image around 312.5-75=237.5Hz, the other pilot tones you have around 33kHz and 66kHz and the low-pass component near 0Hz). To get rid of those, you should then low-pass filter your y signal. You may be able to adjust the filter transition band but looking at your graph, it would seem that you need to include signal within roughly 4-5kHz of your 75kHz center frequency, and exclude the next interference at around 66kHz (9kHz away from your 75kHz center frequency). Based on Kaiser Window Lowpass Filter Design sample from Matlab documentation you could design such a filter with:

fcuts = [4000 9000];
mags = [1 0];
devs = [0.05 0.01];

[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fs);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');

filtered_signal = filter(hh, 1, y);

Then you should be able to decimate your signal by a factor of approximately 24 (giving a final sampling rate of ~13kHz to fit the approximate signal bandwidth of 8000Hz and the transition band):

decimation_factor = 24;
baseband = filtered_signal(1:decimation_factor:end);

That process, although fairly simple to visualize is also fairly wasteful since you end up throwing away most of your filtered outputs. An efficient implementation would then use a polyphase FIR decimator making use of the same filter coefficients as designed above:

firdecim = dsp.FIRDecimator ('DecimationFactor',decimation_factor, 'Numerator', hh);
baseband = firdecim(y);