jgaeddert / liquid-dsp

digital signal processing library for software-defined radios
http://liquidsdr.org
MIT License
1.89k stars 443 forks source link

Problems with the "firhilb_example.c" example #302

Open righthalfplane opened 2 years ago

righthalfplane commented 2 years ago

I have been trying to use the firhilbf routines, but I have not been getting what I expected. I modified the firhilb_example.c to start with a complex sine wave and added plotting output for my plotting program. When I look at the output for x and z, I see what I expected. For the y plot I expected to see twice the frequency and a constant amplitude, but I got like 5 times the frequency and a changing amplitude - were my expectations wrong ? Here are the plots and the modified program.

x-real y-real z-real firhilb_example01.txt

jgaeddert commented 1 year ago

Thanks for reaching out. So I think part of the confusion is with what the firhilbf object is doing when you call interp_execute() and decim_execute(). The output you show above is about what I would expect given the input. Here's what's going on:

Below is the output of the unmodified example of firhilb_example.c with three signals:

  1. The original input: a pair of complex sine waves with a Hamming window
  2. The output of interp (complex -> real) on the input
  3. The output of decim (real -> complex) on interp to provide nearly the same as the original input

If you look at the corresponding spectral responses, you'll notice that I've shifted the plots of the complex signals to show how they align with the real-valued signals. But the time-domain series of the real-valued signal is similar to what you're seeing.

image