DSPRelated.com
Forums

mixing sine waves

Started by viswanath May 11, 2004
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?
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
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?
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
2sin(w1*t)sin(w2*t) = cos[(w1-w2)t]-cos[(w1+w2)t]

On 11 May 2004, 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? > 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" <daita@eng.usf.edu> wrote in message
news:791e9679.0405111129.111fd12f@posting.google.com...
> 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?
You are multiplying time domain values to get 1 set of time values. The sum and difference frequencies are in the frequency domain. I'm sure you agree that a single set of time values can have multiple frequency components. That should explain your paradox.
> How do we end up getting a difference frequencies and sum frequencies > which have to be low pass filtered? > 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
When they say "mixing," it means "apply a nonlinear operation."
When you do THAT, you get sum and difference freq's like the
formula a previous reply contained.

for example, if you receive a signal consisting of a 
1000 Hz waveform and a 10Hz waveform, then multiply by itself,
you'll find it contains frequencies 10,20,990,1010,2000.



On 2004-05-11, viswanath <daita@eng.usf.edu> 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? > 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
-- different MP3 every day! http://gweep.net/~shifty/snackmaster . . . . . . . . ... . . . . . . "Maybe if you ever picked up a goddamn keyboard | Niente and compiler, you'd know yourself." -Matthew 7:1 | shifty@gweep.net
Me wrote:

> ... Scale the 100Hz wave to be half the amplitude of the > 1000Hz wave. The 0.5 offset causes the o/p amplitude to vary around an > average value, as is typical of AM radio stations.
It's not clear from that that a DC offset is involved. An equation for AM at m modulation factor (m = 1 is 100% modulation) and unity carrier amplitude is v = sin(w_c*t)*[1 + m*sin(w_m*t)]/2 (I hope it's clear that w_c and w_m are the carrier and modulating frequencies, respectively.) The equation remains valid if either sine is changed to cosine (or both). Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"viswanath" <daita@eng.usf.edu> wrote in message
news:791e9679.0405111129.111fd12f@posting.google.com...
> 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? > 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?
Is it possible that you are really concerned about various kinds of aliasing? Let's take a simple case: sin(2*pi*100*t) and sin(2*pi*120*t) We will assume that these are sampled at 300Hz (which is 2.5 times 240Hz which is 2 times 120Hz, the highest frequency component. The sample interval is then T=1/300 seconds. We will assume that the record of samples of temporal length NT encompasses some integral number of seconds NT so that N must be some integral multiple of 300. This way we can assume that the record of N samples is a single period of a periodic waveform with no transients at the edges. That way we don't have to worry about frequency components that approach 2 times 120Hz - 240Hz, the Nyquist limit for the highest frequency component. The original 100Hz waveform has components at +/-100Hz and repeats at +/-200Hz and +/-400Hz (mirrored around +/-300Hz), etc. ad infinitum. The original 120Hz waveform has components at +/-120Hz and repeats at +/-180Hz and +/-420Hz (mirrored around +/-300Hz), etc. ad infinitum. So, there are already components at sum and difference frequencies of the original sinusoids and the sample rate - before any mixing is done. We note that this spectrum is periodic at 300Hz. Because the time record is discrete, it implies the spectrum is periodic as above. So, if you choose to conveniently show only one period of the spectrum as would be done with a DFT pair then the 200Hz component and the -100Hz component are coincident and you don't see any of the higher frequencies. You only see them if you plot the peridic spectrum from -infinity to +infinity or if you plot the periodic spectrum in a "super" period say from zero to 3000Hz where 10 periods of the spectrum are shown. This changes nothing, it's just how you decide to look at it. OK. Now we will conceptually prepare to "mix", i.e. multiply, the two records of samples together. We note that multiplying in time is equivalent to convolving in frequency. Let us assume that we are starting with N samples in time and, thus, N samples in frequency over a single spectral period. In order to do a circular convolution in frequency without overlap, the frequency samples need to be zero-extended so there are 2*N samples. This means adding 300 zeros from where the existing samples lie at 150Hz to 450Hz which has the effect of increasing the spectral period. The temporal sample rate thus changes to 600Hz and there are 2x the number of samples. There remain to be N*T seconds in the temporal record. Now the spectra have terms at 100 and 500Hz (-100Hz) and at 120 and 480Hz (-120Hz). When the circular frequency convolution is done, you get spectral components at: 20Hz = 120 - 100, 220Hz = 120 + 100, 380Hz = 480 - 100, 580Hz = 480 + 100 Had the zero-extension from 150 to 450Hz not been done, the components at 380Hz and 580Hz would be aliased such that there would only be terms at: 20Hz, 80Hz, 220Hz and 280Hz. 20Hz = 120 - 100 as before 80Hz = 180 - 100 which is an aliased version of the 380Hz term 220Hz = 120 + 100 as before 280Hz = 180 + 100 which is an aliased version of the 580Hz term So, in order to multiply two temporal records, it appears that you need to increase the sample rate by a factor of 2 before you do it. Or maybe the rule is more complicated but I don't see that right now. Fred
Not quite as many a that!  This is what music synthesists call "ring 
modulation". In the days of analogue  subtractive synthesis, this was just about 
the only way to obtain inharmonic sounds (also famed as the method for turning 
the speaking voice into a Dalek). You get (just) the sum and difference 
frequencies, but neither of the input frequencies. So, with inputs at 1000 and 
10, you will get (just) 900 and 1010. The difference of these is 20Hz, which you 
may hear as a roughness in the sound. This is audible beating right at the 
threshold of becoming a pitched tone; but this is an artefact of the human 
hearing mechansim, it will not show up as a frequency component using FFT, for 
example.

Richard Dobson


Tachyon wrote:

> When they say "mixing," it means "apply a nonlinear operation." > When you do THAT, you get sum and difference freq's like the > formula a previous reply contained. > > for example, if you receive a signal consisting of a > 1000 Hz waveform and a 10Hz waveform, then multiply by itself, > you'll find it contains frequencies 10,20,990,1010,2000. > > >
On 2004-05-12, Richard Dobson <richarddobson@blueyonder.co.uk> wrote:
> Not quite as many a that! This is what music synthesists call "ring > modulation". In the days of analogue subtractive synthesis, this was just about > the only way to obtain inharmonic sounds (also famed as the method for turning > the speaking voice into a Dalek). You get (just) the sum and difference > frequencies, but neither of the input frequencies. So, with inputs at 1000 and > 10, you will get (just) 900 and 1010.
Oops, I changed the discussion a little bit. The OP was talking about mixing two separate signals, then I started talking about non-linear operations on a signal containing two frequencies. Nevertheless, though, there is still an error in my post:
>> for example, if you receive a signal consisting of a >> 1000 Hz waveform and a 10Hz waveform, then multiply by itself, >> you'll find it contains frequencies 10,20,990,1010,2000.
It should read "...it contains frequencies 20,990,1010,2000." -N
> Tachyon wrote: > >> When they say "mixing," it means "apply a nonlinear operation." >> When you do THAT, you get sum and difference freq's like the >> formula a previous reply contained. >> >> for example, if you receive a signal consisting of a >> 1000 Hz waveform and a 10Hz waveform, then multiply by itself, >> you'll find it contains frequencies 10,20,990,1010,2000. >> >> >> >
-- different MP3 every day! http://gweep.net/~shifty/snackmaster . . . . . . . . ... . . . . . . "Maybe if you ever picked up a goddamn keyboard | Niente and compiler, you'd know yourself." -Matthew 7:1 | shifty@gweep.net
Richard Dobson wrote:

> Not quite as many a that! This is what music synthesists call "ring > modulation". In the days of analogue subtractive synthesis, this was > just about the only way to obtain inharmonic sounds (also famed as the > method for turning the speaking voice into a Dalek). You get (just) the > sum and difference frequencies, but neither of the input frequencies.
Otherwise, it is called a doubly balanced mixer.
> So, with inputs at 1000 and 10, you will get (just) 900 and 1010. The > difference of these is 20Hz, which you may hear as a roughness in the > sound. This is audible beating right at the threshold of becoming a > pitched tone; but this is an artefact of the human hearing mechansim, it > will not show up as a frequency component using FFT, for example.
One use they have been put to is voice scrambling. Not so secure, but it works well enough for some uses. Also in the demodulator for FM stereo signals. -- glen