discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird behaviour of the analog signal source


From: Marcus D. Leech
Subject: Re: Weird behaviour of the analog signal source
Date: Mon, 02 Mar 2020 19:33:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 03/02/2020 04:45 PM, Lukas Haase wrote:
Hi Marcus,

How can (or better: *should*) a fully digital signal source have phase noise?

Also, for 1Hz at 5MSps I always get either 5005789 or 5005790 samples (instead 
of 5000000) ... this is fairly deterministic.

Experimenting a bit, I see the weirdest behaviour of the analog signal source.
In my opinion, the source should be fully deterministic. But it is not.

Example 1: I pipe the output of the signal source into a file:

https://snipboard.io/xY1JvE.jpg

and read it with MATLAB:

data = read_float_binary('baszmeg.dat');

Then I compare it to an ideal (=expected) version:

t = 0:1/fs:(length(data)-1)/fs;
plot(t, [data - sin(2*pi*t)' ])

https://snipboard.io/ecTaFL.jpg

Now, I would not care too much about a constant phase shift or similar, but it 
can be seen that the frequency slowly drifts (this is also seen if I just plot 
them on top of each other).

Example 2: I extend the block diagram with blocks that should never alter the 
behaviour as they are only reading samples:

https://snipboard.io/W6kyF0.jpg

Note that the "Controller" is a simple Embedded Python block that only reads 
the input samples into a temporary variable:

def work(self, input_items, output_items):
     squared_wave = input_items[0]
     squared_wave[np.where(input_items[0] > 0)] = 1
     output_items[0][:] = input_items[0]
     return len(output_items[0])

However, now the saved data is distorted:

https://snipboard.io/amyn3X.jpg


Any suggestions highly appreciated.

Thanks,
Lukas


Someone with more insight into the guts of the signal source needs to comment here.

It looks like it moves back-and-forth between integer and floating-point representations, and doing so, finite-precision problems can easily
  creep in.  But that's just an educated guess on my part.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]