discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Generating carrier from samples


From: CEL
Subject: Re: [Discuss-gnuradio] Generating carrier from samples
Date: Sat, 15 Sep 2018 13:54:03 +0000

How bad is your SNR? This really sounds like a job for a PLL!

Best regards,
Marcus
On Sat, 2018-09-15 at 06:28 +0000, Milos Milosavljevic wrote:
> Thank you Marcus. You are right. There must be some nasty
> oscillations and phase discontinuities. I was interpolatating but it
> seems that reletionship between interpolation factor vs sampling rate
> is also wrong. 
> 
> Anyway, I ended up writing custom freq modulator. :) Still in
> debugging phase but initial tests look promising. Will see where that
> gets me.
> 
> In a nutshell, all I am trying to do is calculate a freq offset per
> each sample coming in (well it is flexible can be per any specified
> num of samples). It is a bit computational intensive but sample rates
> are relatively low so I can afford it (I hope). 
> 
> Thanks for you help.
> Milos
> 
> Get Outlook for Android
> 
> From: Müller, Marcus (CEL) <address@hidden>
> Sent: Thursday, September 13, 2018 5:19:19 AM
> To: address@hidden
> Cc: address@hidden
> Subject: Re: [Discuss-gnuradio] Generating carrier from samples
>  
> Hi Milos,
> 
> no need to apologize!
> 
> > The DFT is a sliding window DFT which gives me the output per each
> sample instead of calculating the DFT for the whole N (well it gives
> DFT per sample but I take output after 2 samples in my case).
> 
> That explains the halfing of numbers from in- to output.
> 
> > I then store those peaks in a vector.
> 
> Trying to understand what "storing these peaks" means: do you mean
> putting the peak's index into a vector element? Or its converted
> frequency? Or its amplitude?
> 
> > (each input to the vector represents a frequency)
> 
> Ah! Ok, that answers the above question. 
> 
> > So for each pair of input samples (in that 1024 vector above) the
> output vector will look something like this - in Hz [0 0 0 2000 2000
> 2000 -1000 0 0 0 ...]. I now want to take that output vector and
> generate a tone for each sample pair at time t (ie it doesnt generate
> all the tones at once but each tone at specific time). So e.g. the
> first three pairs will have 0Hz, then the 4th pair will have tone at
> 2000Hz, etc.
> 
> Well, the problem that I can see here is that you're switching
> frequency - potentially from sample to sample – based on a quantized
> frequency estimate:
> You have a 1024-FFT, so there's only 1024 frequencies you can
> accurately detect (namely, -f_s/2 to +f_s/2 in steps of f_s/1024).
> All other frequencies will have leakage into multiple bins, and that
> makes the estimate less stable, and of course, can lead to
> interesting
> oscillating estimates if the actual frequency happens to fall in the
> middle between two FFT bins. 
> 
> Other than that, the frequency modulator is generally what you want –
> convert a frequency floating point value into a single tone of a
> single
> frequency. Maybe you want to interpolate your frequency estimates
> prior
> to sending them into the frequency mod?
> 
> > So I take 1024 vector and perform DFT on each sample and then I
> find,
> lets say, one top frequency after 2 samples as I mentioned above
> (because of the nature of my input signal there will be a peak
> somewhere in that DFT).
> 
> Sounds like you want to estimate a main frequency component – in that
> case, have you considered parametric spectrum estimators instead of
> the
> sliding window DFT? They could potentially give you higher frequency
> resolution with less input, in some cases (many cases) even with less
> computational effort!
> 
> Maybe you could tell us a tiny bit more about the larger context of
> why
> you're doing this, so we can advise more appropriately?
> 
> Best regards,
> Marcus
> 
> On Tue, 2018-09-11 at 10:31 +0100, Milos Milosavljevic wrote:
> > Hi Marcus,
> > Thanks for coming back to me and I apologies for the vague
> description of my problem. Let me try to clarify what i meant
> please. 
> > 
> > The DFT is a sliding window DFT which gives me the output per each
> sample instead of calculating the DFT for the whole N (well it gives
> DFT per sample but I take output after 2 samples in my case). 
> > 
> > So I take 1024 vector and perform DFT on each sample and then I
> find, lets say, one top frequency after 2 samples as I mentioned
> above (because of the nature of my input signal there will be a peak
> somewhere in that DFT). 
> > 
> > All the above happens in one block. 
> > 
> > I then store those peaks in a vector. So for each pair of input
> samples (in that 1024 vector above) the output vector will look
> something like this - in Hz [0 0 0 2000 2000 2000 -1000 0 0 0 ...]. I
> now want to take that output vector and generate a tone for each
> sample pair at time t (ie it doesnt generate all the tones at once
> but each tone at specific time). So e.g. the first three pairs will
> have 0Hz, then the 4th pair will have tone at 2000Hz, etc.
> > 
> > I tried feeding that output vector above to vector to stream and
> then freq mod block but that obviously didnt get me very far. It
> works fine if my signal is ideal. If i introduce frequency error the
> output is too distorted. 
> > 
> > My question is really, is there an efficient way to convert an
> output vector of samples to frequency  (each input to the vector
> represents a frequency). 
> > 
> > Thanks 
> > Milos
> > 
> > 
> > On 11 September 2018 at 08:21, Müller, Marcus (CEL) <
> address@hidden> wrote:
> > > Hi Milos,
> > > 
> > > I must admit I don't fully understand what your "DFT block" does
> – how
> > > does it reduce from 1024 to 512 values per item? What does each
> value
> > > mean? why would the frequency mod block deal with these in a way
> that
> > > generates multiple tones?
> > > 
> > > Best regards,
> > > Marcus
> > > 
> > > On Mon, 2018-09-10 at 23:57 +0100, Milos Milosavljevic wrote:
> > > > Dear All,
> > > > 
> > > > From my own DFT output I am calculating top frequencies. I want
> to
> > > > take each of the calculated frequency (e.g. my calculation
> gives me
> > > > something like -2400, 1024, 0, 0, 0, -2400) and generate a
> carrier
> > > > with the corresponding frequency. The algorithm is correct and
> the
> > > > implementation seems fine.
> > > > 
> > > > But I tried using the Freq Modulator block to give me the
> carrier but
> > > > the output is just too distorted. What would be the best way to
> go
> > > > around this?
> > > > 
> > > > I have something like this:
> > > > Input (stream) -> StreamToVector(1024 vlen) --> DFT (out is
> vector of
> > > > top freqs of len 512) --> VectorToStream (512) -->
> Repeat(Interpolate
> > > > by 2) --> FreqMod(sensitivity -1.0/(float(samp_rate)/(2*pi)))
> > > > 
> > > > Any comments will be appreciated.
> > > > 
> > > > Many thanks,
> > > > Milos
> > > > 
> > > > 
> > > > _______________________________________________
> > > > Discuss-gnuradio mailing list
> > > > address@hidden
> > > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> > 
> > 
> > 

reply via email to

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