I imagine the carrier signal is produced by the demodulator to be
in-phase with the local oscillators.
bg_ie@yahoo.com (Barry) wrote in message news:<731cea69.0308161329.6de57893@posting.google.com>...
> Hi everyone,
>
> I'm trying to demodulate the following in order to obtain "signal" -
>
> cos(cos(2*PI*11025*i/88200.0) + signal)
>
> I'm using a signal of -
>
> cos(2*PI*1102.5*i/88200.0)
>
> so I'm actually demodulating -
>
> intensity[i] = cos( cos(2*PI*11025*i/88200.0) +
> cos(2*PI*1102.5*i/88200.0))
>
> To demodulate this signal, I consider two bands. The first band is
> around 11025Hz, and the second is around 2*11025Hz.
>
> The first stage of the demodulation scheme involves individually
> shifting these two bands into the base band, as follows -
>
> for( i=0;i<SIZE;i++)
> {
> mix1[i] = cos(w(11025)*i/double(SR))*intensity[i];
> mix2[i] = cos(2*w(11025)*i/double(SR))*intensity[i];
> }
>
> // low pass the base band, to remove all other bands
> filterInit(11025/2.0,filter1,b);
> for(i=0;i<SIZE;i++)
> mix1[i] = filterLP(mix1[i], filter1, b);
>
> filterInit(11025/2.0,filter2,b);
> for(i=0;i<SIZE;i++)
> mix2[i] = filterLP(mix2[i], filter2, b);
>
> Mix1 and mix2 above are equal to -
>
> J1(1)sin(signal) = J1(1)sin(cos(2*PI*11025*i/88200.0))
>
> J2(1)cos(signal) = J2(1)cos(cos(2*PI*11025*i/88200.0))
>
> Where J is a bessel function.
>
> I then diff and cross multiply, add the result, and intergrate that to
> get "signal" -
>
> diff1[0] = 0;
> for(i=1;i<SIZE;i++)
> diff1[i] = (mix2[i] - mix2[i-1]) * mix1[i];
>
> diff2[0] = 0;
> for(i=1;i<SIZE;i++)
> diff2[i] = (mix1[i] - mix1[i-1]) * mix2[i];
>
> for(i=0;i<SIZE;i++)
> sum[i] = diff1[i] - diff2[i];
>
> output[0] = 0;
> for(i=1;i<SIZE;i++)
> output[i] = sum[i] + /*0.995*/ sum[i-1];
>
> the maths of which is -
>
> the integral of
>
> J1(C)*J2(C)*diff(signal)*(cos(signal)^2) +
> J1(C)*J2(C)*diff(signal)*(sin(signal)^2)
>
> //cos^2 + sin^2 = 1
>
> This algorithm worked fine when I simulated it, but now I've realized
> that it doesn't work when my original signal has a phase shift - such
> as -
>
> intensity[i] = cos( cos(2*PI*11025*i/88200.0) +
> cos(2*PI*11025*i/88200.0))
> intensity + 5 = intensity. // shift by 5 samples
>
>
> The problem is that the modulation and the local oscillators, both at
> 11025Hz, are not in phase.
>
> Another way of causing this problem is if I change my code to -
>
> for( i=0;i<SIZE;i++)
> {
> mix1[i] = cos(w(11025)*(i+7)/double(SR))*intensity[i];
> mix2[i] = cos(2*w(11025)*(i+7)/double(SR))*intensity[i];
> }
>
>
> What might I do to avoid this problem? This demodulation scheme is
> refered to as homodyne demodulation using phase generated carrier
> (avoids signal fading)
>
> Regards.
Reply by Barry●August 16, 20032003-08-16
Hi everyone,
I'm trying to demodulate the following in order to obtain "signal" -
cos(cos(2*PI*11025*i/88200.0) + signal)
I'm using a signal of -
cos(2*PI*1102.5*i/88200.0)
so I'm actually demodulating -
intensity[i] = cos( cos(2*PI*11025*i/88200.0) +
cos(2*PI*1102.5*i/88200.0))
To demodulate this signal, I consider two bands. The first band is
around 11025Hz, and the second is around 2*11025Hz.
The first stage of the demodulation scheme involves individually
shifting these two bands into the base band, as follows -
for( i=0;i<SIZE;i++)
{
mix1[i] = cos(w(11025)*i/double(SR))*intensity[i];
mix2[i] = cos(2*w(11025)*i/double(SR))*intensity[i];
}
// low pass the base band, to remove all other bands
filterInit(11025/2.0,filter1,b);
for(i=0;i<SIZE;i++)
mix1[i] = filterLP(mix1[i], filter1, b);
filterInit(11025/2.0,filter2,b);
for(i=0;i<SIZE;i++)
mix2[i] = filterLP(mix2[i], filter2, b);
Mix1 and mix2 above are equal to -
J1(1)sin(signal) = J1(1)sin(cos(2*PI*11025*i/88200.0))
J2(1)cos(signal) = J2(1)cos(cos(2*PI*11025*i/88200.0))
Where J is a bessel function.
I then diff and cross multiply, add the result, and intergrate that to
get "signal" -
diff1[0] = 0;
for(i=1;i<SIZE;i++)
diff1[i] = (mix2[i] - mix2[i-1]) * mix1[i];
diff2[0] = 0;
for(i=1;i<SIZE;i++)
diff2[i] = (mix1[i] - mix1[i-1]) * mix2[i];
for(i=0;i<SIZE;i++)
sum[i] = diff1[i] - diff2[i];
output[0] = 0;
for(i=1;i<SIZE;i++)
output[i] = sum[i] + /*0.995*/ sum[i-1];
the maths of which is -
the integral of
J1(C)*J2(C)*diff(signal)*(cos(signal)^2) +
J1(C)*J2(C)*diff(signal)*(sin(signal)^2)
//cos^2 + sin^2 = 1
This algorithm worked fine when I simulated it, but now I've realized
that it doesn't work when my original signal has a phase shift - such
as -
intensity[i] = cos( cos(2*PI*11025*i/88200.0) +
cos(2*PI*11025*i/88200.0))
intensity + 5 = intensity. // shift by 5 samples
The problem is that the modulation and the local oscillators, both at
11025Hz, are not in phase.
Another way of causing this problem is if I change my code to -
for( i=0;i<SIZE;i++)
{
mix1[i] = cos(w(11025)*(i+7)/double(SR))*intensity[i];
mix2[i] = cos(2*w(11025)*(i+7)/double(SR))*intensity[i];
}
What might I do to avoid this problem? This demodulation scheme is
refered to as homodyne demodulation using phase generated carrier
(avoids signal fading)
Regards.