# mixing sampled sine waves

Discussion in 'VHDL' started by viswanath, May 11, 2004.

1. ### viswanathGuest

Hi,
I have a question regarding mixing discrete sine waves. If you have
two sine waves sin(w1*t) and sin(w2*t) and they are sampled at the
same rate. If you are mixing them in a receiver operation, we are
supposed to get at the output of the mixer the sum and difference of
frequencies. But it is just the values that we are multiplying isn't
it, at the sampled time instants?
How do we end up getting a difference frequencies and sum frequencies
which have to be low pass filtered? If I implemented this in VHDL and
used math_real library functions sin() and real variables, I would
just be multiplying the two numbers at each time sample. This value
would encompass the frequency of the sine wave. However I donot
understand how I would be getting a difference in frequency and sum in
frequency terms?
I have read from trigonometry and analog communications but somehow I
am missing some essence here. Could you please let me know how the
above is possible?
I would greatly appreciate a response.
Thanks,
Viswanath

viswanath, May 11, 2004

2. ### Allan HerrimanGuest

On 11 May 2004 12:35:13 -0700, (viswanath) wrote:

>Hi,
>I have a question regarding mixing discrete sine waves. If you have
>two sine waves sin(w1*t) and sin(w2*t) and they are sampled at the
>same rate. If you are mixing them in a receiver operation, we are
>supposed to get at the output of the mixer the sum and difference of
>frequencies. But it is just the values that we are multiplying isn't
>it, at the sampled time instants?
>How do we end up getting a difference frequencies and sum frequencies
>which have to be low pass filtered? If I implemented this in VHDL and
>used math_real library functions sin() and real variables, I would
>just be multiplying the two numbers at each time sample. This value
>would encompass the frequency of the sine wave. However I donot
>understand how I would be getting a difference in frequency and sum in
>frequency terms?
>I have read from trigonometry and analog communications but somehow I
>am missing some essence here. Could you please let me know how the
>above is possible?

Firstly, find a table of trig identities:

Then find the one that looks like a product of sinusoids on one side
and a sum (or difference) of sinusoids on the other, e.g.

cos x - cos y = -2 sin( (x-y)/2 ) sin( (x + y)/2 )

Express this in terms of your original w1*t and w2*t :

cos((w1+w2)*t) - cos((w1-w2)*t) = -2 sin(w1*t) sin(w2*t)

The right hand side is the two sine waves you are multiplying
together, sample by sample.
The left hand side is the 'sum' of two sinusoids at the sum and
difference frequencies that produces identical values, sample by
sample.

If you apply a frequency selective filter, you can get rid of the
(w1+w2) term, and just leave the (w1-w2) term.

Note: this is not magic, just a trig identity. It may take a while to