DSPRelated.com
Forums

SDR Captured Files samples scaling

Started by engrmasood2002 July 1, 2014
Hi, All
Please ignore my question if any one thinks it to be stupid as i am novice
in DSP but learning and experimenting DSP techniques.
I have been doing FM/AM demodulation in various captured files for RF
signals that i have downloaded from internet including gnuradio, SDRSharp
and RTL-SDR files.
These all works fine as long as i read and multiply samples read from file
with some constant for proper scaling for example if they are like I=423.0,
Q=-234.0 then i multiply by 0.001 always to get the results but when they
are between -1.0 to 1.0 then i don't need any scaling.
My question, Is there any way to know true multiplication factor as next
time i might have downloaded file giving samples stored by other hardware
in range I=1422.00 and Q=2345.0.
 How can i make it generic for software to scale because I/Q values ranges
different in different files? (i think its different from AGC as in AGC we
control values within our boundaries of min and max values and here we have
to establish our boundary for sample values).

Thanks	 

_____________________________		
Posted through www.DSPRelated.com
Hi, 

the question is surprisingly complex. You'll have to implement your own
AGC, in a way.

As long as there is a strong wanted channel and nothing else, you can
- sum up squared I samples
- add squared Q samples
- divide sum by number of samples
- take the square root
- divide the whole signal (I and Q individually) by the resulting number

This will normalize your signal to 1.0 RMS. 
It gets more complicated when there are strong neighboring channels. On a
PC, you'd simply filter out the wanted signal first, then normalize. In
hardware / real time, AGC is one of the things that makes receiver design
so interesting.

	 

_____________________________		
Posted through www.DSPRelated.com
On Tue, 01 Jul 2014 08:56:35 -0500, "mnentwig" <24789@dsprelated>
wrote:

>Hi, > >the question is surprisingly complex. You'll have to implement your own >AGC, in a way. > >As long as there is a strong wanted channel and nothing else, you can >- sum up squared I samples >- add squared Q samples >- divide sum by number of samples >- take the square root >- divide the whole signal (I and Q individually) by the resulting number > >This will normalize your signal to 1.0 RMS. >It gets more complicated when there are strong neighboring channels. On a >PC, you'd simply filter out the wanted signal first, then normalize. In >hardware / real time, AGC is one of the things that makes receiver design >so interesting.
This suggested method removes any modulation or information in the signal amplitude, which is okay for a signal that is strictly FM, but not for many other signals. For signals where the amplitude is useful then some filtering must be applied to the detected amplitude, with a filter bandwidth that is small enough to not remove useful information from the amplitude. If this is done prior to any signal or IF filtering, then this will gain control to the composite power of all signals present, which can be useful but may not be the desired final result. To get the desired signal only to the desired amplitude, all other signals must be filtered out first. That's pretty much a restatement of the above post, but I wanted to add some detail. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Tue, 01 Jul 2014 14:52:15 +0000, Eric Jacobsen wrote:

> On Tue, 01 Jul 2014 08:56:35 -0500, "mnentwig" <24789@dsprelated> wrote: > >>Hi, >> >>the question is surprisingly complex. You'll have to implement your own >>AGC, in a way. >> >>As long as there is a strong wanted channel and nothing else, you can - >>sum up squared I samples - add squared Q samples - divide sum by number >>of samples - take the square root - divide the whole signal (I and Q >>individually) by the resulting number >> >>This will normalize your signal to 1.0 RMS. >>It gets more complicated when there are strong neighboring channels. On >>a PC, you'd simply filter out the wanted signal first, then normalize. >>In hardware / real time, AGC is one of the things that makes receiver >>design so interesting. > > This suggested method removes any modulation or information in the > signal amplitude, which is okay for a signal that is strictly FM, but > not for many other signals.
Actually, I was reading the suggested method as arriving at one number and then scaling the whole vector by that one number. In that case then you _do_ preserve your necessary amplitude information. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Tue, 01 Jul 2014 08:56:35 -0500, mnentwig wrote:

> Hi, > > the question is surprisingly complex. You'll have to implement your own > AGC, in a way. > > As long as there is a strong wanted channel and nothing else, you can - > sum up squared I samples - add squared Q samples - divide sum by number > of samples - take the square root - divide the whole signal (I and Q > individually) by the resulting number > > This will normalize your signal to 1.0 RMS. > It gets more complicated when there are strong neighboring channels. On > a PC, you'd simply filter out the wanted signal first, then normalize. > In hardware / real time, AGC is one of the things that makes receiver > design so interesting.
To put it more succinctly, calculate the variance of the entire vector (I and Q), and then normalize it to 1. Touching on previous posts -- this is easier with Scilab or Matlab than with C++. In Scilab, if you have the input as a complex vector, it's one line: Aout = Ain / (sqrt(mean(abs(Ain) .^ 2))); -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
>> Actually, I was reading the suggested method as arriving at one number
and then scaling the whole vector by that one number. In that case then you _do_ preserve your necessary amplitude information Hi, that was the idea, yes. Scaling with one common factor to normalize to unity variance. It may be a good idea to remove DC offset first, but let's keep things simple. _____________________________ Posted through www.DSPRelated.com
On Tue, 01 Jul 2014 13:50:00 -0500, Tim Wescott
<tim@seemywebsite.really> wrote:

>On Tue, 01 Jul 2014 14:52:15 +0000, Eric Jacobsen wrote: > >> On Tue, 01 Jul 2014 08:56:35 -0500, "mnentwig" <24789@dsprelated> wrote: >> >>>Hi, >>> >>>the question is surprisingly complex. You'll have to implement your own >>>AGC, in a way. >>> >>>As long as there is a strong wanted channel and nothing else, you can - >>>sum up squared I samples - add squared Q samples - divide sum by number >>>of samples - take the square root - divide the whole signal (I and Q >>>individually) by the resulting number >>> >>>This will normalize your signal to 1.0 RMS. >>>It gets more complicated when there are strong neighboring channels. On >>>a PC, you'd simply filter out the wanted signal first, then normalize. >>>In hardware / real time, AGC is one of the things that makes receiver >>>design so interesting. >> >> This suggested method removes any modulation or information in the >> signal amplitude, which is okay for a signal that is strictly FM, but >> not for many other signals. > >Actually, I was reading the suggested method as arriving at one number >and then scaling the whole vector by that one number.
Duh. Musta read it too fast or something.
> In that case then >you _do_ preserve your necessary amplitude information. > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com