First post and very new in the dsp world but I'm learning.

For a small project I need two sine waves, e.g. 10 and 20khz. I placed a sine tone of 10khz and used the multiplication block to get the 20khz tone. Obeserving both waves on a oscillioscope I discovered that they seemed to be phase locked (prob are) but the sine waves don't cross the zero axis at the same point. My guess is that they are 45 deg shifted. Of course I can use a delay or all pass filter to correct this but rather not. Is there any simple solution to this? Why are they shifted?

Simon

Hello Simon,

Squaring the sine wave is a good way to get a synchronized double-frequency wave, as this uses the trig identity:

sin^2(theta) = 0.5*(1-cos(2*theta))

Problem is, since the result includes a cosine, it's phase shifted 90 degrees from where you want it (or, 45 degrees from the original sine wave). To fix this, you'll need to do a 45 degree shift ahead of the square. As you pointed out, a delay or filter would work but would not be preferable. The method shown below avoids these, and in addition it keeps the two outputs correctly phased even with an adjustable frequency.

Recent versions of SigmaStudio include a

Quadrature VCOblock; version 3.9 Beta added this feature to the ADAU1701/2.. It outputs both a sine and a cosine wave. Adding these together provides a 45-degree shifted wave. This in turn can be squared to provide your double-frequency output. Fundamental frequency is set by the DC source:V = 2* f / fs

In the above example, I set the frequency to only 0.1 Hz, to view the outputs on two Real-Time Displays. To make this run at 10KHz, set the DC source to 0.41667

When I tried this the two Real-Time Displays did appear to go through zero simultaneously, although the real test will be when you run it full speed and view the results on your scope.

Best regards,

Bob