What I don't understand is the connection between the sample rate, the baud rate, decimation and using convolution or correlation.

I'm sampling at 2048000 Hz but I don't know my baud rate, I estimated it (by looking at the time length of one of the short pulses) to be about 2000 pulses per second.

So these are my steps (roughly):

  1. get samples
  2. demodulate
  3. decimate by about 1000
  4. correlate with ones

Here is an example of what my signal looks like after demodulation:

enter image description here

You can see that there are 4 symbols but many many samples. How can I turn those many many sample into just 4 symbols? I think it is related to convolution/correlation, but I'm not sure how.

  • $\begingroup$ Normally, you first filter and then downsample/decimate the filtered signal. If you show us more of your signal and what kind of pulse shaping you use, we might be able to help more. $\endgroup$ Nov 16 '16 at 18:23
  • $\begingroup$ right, i added a screenshot $\endgroup$
    – Nick Lang
    Nov 16 '16 at 18:31
  • 1
    $\begingroup$ So, I suppose you are facing a PWM modulation? I.e. the width of the pulse contains the information transmitted? Which sequence do you expect to be demodulated from the signal in the screenshot? $\endgroup$ Nov 16 '16 at 19:02
  • $\begingroup$ I thought it was ASK. But regardless, yes I expect something like: 0100 or perhaps 00110000 or maybe even 000110100100. anything sensible would be ok. i just don't know what is the standard approach to get from the samples to symbols. $\endgroup$
    – Nick Lang
    Nov 16 '16 at 19:15
  • $\begingroup$ Might also be ASK, with 2ary symbols (i.e. A=1.2 or A=0). How to get the data out really depends on how the data is modulated. If it's ASK, then you'd convolve/correlate with a rectangular filter that has the length of one symbol. Then, afterwards, you decimate at the symbol rate (i.e. samplerate/symbollength). If it's PWM, you could correlate with two filters: one longer rect, one shorter rect. After decimation of each signal (by same rate as in ASK), you would compare which filter has the higher output and assign the correspnoding bit. $\endgroup$ Nov 16 '16 at 19:24

Here's a general example on how to perform the convolution + decimation for an ASK signal.

amplitudes = [1, 0 0 1 0 1 1 0 1 0];
N = 100; % the symbol length.
pulse = 1.2*ones(N, 1); % the Rx pulse (used for correlation)

% the tx pulse (used to recreate your RX signal);
tx_pulse = pulse + 0.2*sin(2*pi*10/N*(1:N)');

% artificially create a signal
signal = zeros(N*length(amplitudes),1);
for i=1:length(amplitudes)
    signal((i-1)*N+(1:N)) = amplitudes(i) * tx_pulse;
signal = signal + 0.01*randn(size(signal));

title('RX signal');

after_conv = conv(signal, pulse);
title('After convolution');

title('After decimation');

Result of code

  • $\begingroup$ wow thanks, can you explain the line: pulse = 1.2*ones(N, 1); where does the number 1.2 come from? and does ones(N, 1) just make a 1d array of ones that is N long? $\endgroup$
    – Nick Lang
    Nov 16 '16 at 20:11
  • $\begingroup$ and how are you decimating the signal here? $\endgroup$
    – Nick Lang
    Nov 16 '16 at 20:13
  • $\begingroup$ Ok i see how you're decimating, you're using matlab notation: 1:N:end. BUT - what if this isn't lined up so nice, how do you cherry pick the right samples in the decimation stage? $\endgroup$
    – Nick Lang
    Nov 16 '16 at 20:28
  • 1
    $\begingroup$ ones(N,1) in Matlab equals ones((N,1)) in python/numpy. Regaring the decimation point, you need to get somehow a synchronization, i.e. get to know where the symbol starts. Can either be done manually, or by exploiting the signal structure. For your case, e.g. look for strong signal rises to find the start of a symbol. $\endgroup$ Nov 16 '16 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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