Home

Daqarta for DOS Contents

Introduction

Free Registration

Daqarta for DOS
Data AcQuisition And Real-Time Analysis
Shareware for Legacy Systems

From the Daqarta for DOS Help system:

# MISCELLANEOUS, Continued:

## SINE WAVE BASICS:

Consider the second hand on an "old-fashioned" clock face: The hand makes an angle relative to a horizontal line drawn through the shaft from 9 to 3. The sine of that angle is proportional to the height of the tip of the hand above this reference line. (Heights are negative if the tip is below this.) Start with the hand at 9, and measure the height as it passes each numeral on the face:

```          o.............................. Top of
o     o                            face

o           o
Positive

o-----------------o-----------------o--- Shaft
reference
Negative
o           o

o     o
o............ Bottom
of face
|  |  |  |  |  |  |  |  |  |  |  |  |
9 10 11 12  1  2  3  4  5  6  7  8  9
```
This is one cycle a classic sine wave.

The AMPLITUDE of the clock sinusoidal wave is the length of the hand, which is the peak height above or below the horizontal reference line.

The FREQUENCY of the wave is the number of cycles per unit time. On a clock, the second hand completes one cycle per minute. Although those who deal with rotating machinery use Cycles Per Minute (CPM), other users commonly refer to frequency in cycles per second, so we would say that the second hand completes 1/60 cycle per second. One cycle per second is called one Hertz, abbreviated Hz and pronounced "Hurtz" like the car rental agency (although medical doctors sometimes say "Hairtz").

We apply standard scientific prefixes to this, so 1000 Hertz is 1 kiloHertz (kHz) and 1/1000 Hz is 1 milliHertz (mHz). Our second hand thus has a frequency of 1/60 Hz or 0.0166667 Hz or 16.6667 mHz. Note the small 'm' in 'mHz'. A large 'MHz' is used to refer to 1 million Hertz or MegaHertz. Small letters refer to prefixes less than one, capitals to those more than one. The exception to this is small 'k' for kilo... a tribute to the group wisdom of standards committees. Daqarta allows you to enter either 'K' or 'k', but always shows this as 'k'.

### PHASE:

Phase is the measure of the starting point of one sinusoid relative to another. In the clock example the reference starting point was the 9 o'clock position, so any wave that starts there is "in phase" with the reference wave. If a wave starts anywhere else, its angle relative to this reference is its "phase angle". A wave that starts at 6 o'clock (cosine) is thus at an angle of 90 degrees relative to the reference sine:

```            c        s                          c
c     c  s     s                    c

c        s  c        s              c

c        s        c        s        c        s

s              c        s  c        s

s                    c     c  s     s
s                          c        s

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
6  7  8  9 10 11 12  1  2  3  4  5  6  7  8  9
```

In mathematics the 3 o'clock position is always used as the starting point, and everything runs counter-clockwise. Apart from a sign change, the results are the same.

### MAGNITUDE via VECTOR SUM:

It often happens that we can't directly measure the amplitude and phase angle of a sinusoid, but instead we measure its sine and cosine "component" amplitudes. We measured the sine component of the clock face (the height of the hand's pointer) to get our sine waveform. The cosine component is measured similarly, as the length of the "shadow" of the hand on the horizontal axis:

```
o
o         o
.|
o            .  | o
?   |      Sine component
.     |
o          o------|   o
Cosine
component
o                 o

o         o
o
```

We can thus find the true amplitude or "magnitude" as the hypotenuse of this right triangle by taking the square root of the sum of the squares of the sine and cosine components. This is called the "vector sum" of the components. Similarly, we can find the phase as the angle whose tangent is equal to the sine component over the cosine component.

The sine and cosine components are often referred to as the "in-phase" and "quadrature" components, especially in discussions of older analog methods. Engineering math types prefer to use "real" for the cosine component and "imaginary" for the sine component, corresponding to a wonderfully intimidating exponential expression called "complex notation", perfect for casual dining conversation and impressing uninitiated audiences.

### MAKING WAVES VIA SINE WAVE SYNTHESIS:

Any waveform can be synthesized from pure sinusoids. You can use the Daqarta Stimulus Generator to demonstrate the basics of this by generating the fundamental and first few harmonics of square, ramp, or triangle waves.

You will first need to make sure that you have the STIM3A.GEN module in your DQA.CFG file. If you are not certain, you can check the installed plug-in modules via ALT-H. You may also want to replace the acquisition Board driver on the second line of DQA.CFG with the "dummy" board DEMO.ADC driver. This will allow you to simulate wiring the analog stimulus output of a real board into an input channel so you can view it on the main trace and make cursor measurements, etc.

Restart Daqarta, then activate the Board with the B-key and use CTRL-G to bring up the StGen menu. (You can now use CTRL-H to access the Help system for this module, including context-sensitive Help relating to the menu cursor position.) Set the following menu parameters:

```    Master = On
DAC 0 = active
DAC 1 = inactive
DigOut = inactive
```

This will display a reduced-size alternate trace superimposed above the main trace. If you are using the DEMO driver, the main trace will show a full-sized version, as though the stimulus DAC 0 output was connected to the ADC board input Ch0. You can then turn the STIM3A Display OFF if the alternate trace is distracting.

If you are using a "real" board instead of DEMO, you can either connect its DAC 0 output to an input to view the main trace, or if that's not convenient you can just ignore the main trace and view the STIM3A Display.

Now move the STIM3A menu cursor to DAC 0 Setup and hit ENTER to see the Pg A submenu. Set that to be the fundamental frequency... we'll use 100 Hz in this example:

```    Off / On = On
Wave = Sine
Freq = 100
Burst/Cont = Cont
(Leave other modulators off)
Level = 100.00%
```

Use CTRL-PgUp to move to Pg B and set it as the 3rd harmonic, with Freq = 300 and Level = 33.33%, which is 1/3 of the fundamental. Pg C will be the 5th harmonic with a Level of 20% and and Pg D the 7th at 14.29%. As you add each harmonic, you will see the initial sine wave get steeper sides, and the ripples at the peaks get smaller. Notice how each higher harmonic acts to reduce the ripples by providing a complementary wave that fills in dips and rounds off peaks. Although a perfect square wave requires an infinite number of harmonics, it should be clear that if you extended this process you could approximate one to any desired degree of precision.

One curious fact: Notice the "bat-ears" due to overshoot and ringing on the intended horizontal portions. As you add more harmonics according to the formula, these ears become sharper but the peaks never go below about 9% overshoot with any finite number of harmonics. This is known as "Gibb's Phenomenon", and requires a slight modification to the harmonic levels to taper them to zero instead of truncating the series after some arbitrary harmonic number. This is "windowing" in the frequency domain in order to improve the time domain, and is exactly analogous to the time domain window functions commonly used to reduce leakage "skirts" or "sidelobes" in the frequency domain.

You may wish to experiment with other wave shapes, like ramps or triangles. A ramp is made just like the square wave, only using all integer harmonics, not just the odd ones. So the 2nd harmonic is 1/2 the fundamental, the 3rd is 1/3, and the 4th is 1/4. Set the fundamental level to 50% instead of 100% and scale the other components proportionally, since otherwise the waveform would have peaks exceeding 100%.

This will be a "descending" ramp, with the steep side on the left. An identical ramp shifted 90 degrees relative to this can be made by setting the phase of the odd components to 180 degrees. If you want to see both ramps at the same time for comparison, you can build one of them with DAC 1.

To reverse the ramp to an "ascending" version, you can set all the phases to 180 degrees. A shifted ascending ramp results if the odd components are set to 0 degrees and the evens are at 180.

A triangle is made with only odd harmonics, but instead of falling off proportional to the reciprocal of frequency like the square wave, they fall off with the square of the reciprocal. In addition, the phase changes between 0 and 180 degrees with each harmonic used. Again, you will need to start at a reduced level to avoid going over 100%. Try this:

``` Pg    Freq    Phase    Level
A     100     0        50.00
B     300     180       5.56    (50 / 3²)
C     500     0         2.00    (50 / 5²)
D     700     180       1.02    (50 / 7²)
```

## SINGLE-SWEEP (Singl):

Hitting the unshifted S-key causes a single sweep of N samples to be collected, processed, and displayed. During this time the Singl option will be shown as active, but immediately after it will go off and the Pause state will become active. For high sample rates, you probably won't even be able to see the Singl highlight, since it will be so brief.

In Spectrogram mode, Single-Sweep generates one full screen of data, equivalent to 512 sweeps in Wave or Spectrum modes.

## STIMULUS GENERATOR (StGen):

Daqarta allows for arbitrary stimulus generation to be provided by a separate plug-in module. The current offering is STIM3A.GEN, the Advanced Stimulus Signal Generator. This is available only to registered users; others can use it only with the DEMO driver, or for only 30 sessions with actual ADC/DAC hardware. After 30 sessions, unregistered users will still be able to use the older STIM3, available as a separate download from the Daqarta Website.

STIM3A permits continuous signal generation in real-time. Each DAC output can combine up to 4 different sources, including:

Waveforms:

• Sine
• Triangle
• Square
• Pulse (monophasic or biphasic)
• Arbitrary waveform from file
• Play complete recording from file

Random sources:

• White noise, uniform distribution
• Gaussian (normal) distribution white noise
• Pink noise
• Band-limited noise

Each waveform can be modulated by any or all of:

• Burst (Start, Rise, Duration, Fall, Dwell)
• AM
• FM
• PM (Phase Modulation)
or PWM (Pulse Width Modulation)
• Frequency Sweep
(up or down, linear or exponential)

Random sources can use Burst or AM modulators. They can also be slowed, stepped, smoothed, quantized, or time-shifted. (Two identical noise sources combined with a time shift give comb-filtered noise, for example.)

More than one modulator may be used on each source. AM, FM, and PM/PWM modulators can use simple sine modulation (adjustable frequency) or one or more of the other sources. For example, you can have a basic Pulse waveform, and apply FM that uses a noise generator as its source to provide controlled jitter. And that noise source can use AM so that the jitter changes in strength, and the AM source can be an Arb or Play file that you step through slowly to provide a test program of different jitter amounts.

When STIM3A is operated dynamically, continuous signals can have extremely fine frequency resolution (typically better than 0.0001 Hz), and frequency sweeps can be so slow that they last for hours or days, unlike systems that require the entire waveform to be stored in memory.

Up to 8 digital output lines may be controlled to produce pulse trains, bursts, or sync pulses for other equipment.

Best of all, complete signal configurations may be saved to files for automatic load on start-up, or may be saved or loaded at any time during operation. NOTE:
STIM3A currently supports only laboratory-type ADC boards and the ISA-bus Sound Blaster 16/32/64 family of full duplex sound cards. Other sound cards use their built-in synthesizers for stimulus generation. See the help system of your particular card for full details.

If the STIM3A.GEN module is present in your DQA.CFG file, the full Help system for it can be accessed by first using CTRL-G to bring up the StGen control menu, then hitting CTRL-H to get Control Help.

When first starting out, you may find it helpful to use the DEMO driver with STIM3A. When a stimulus output is active, it will be sent to the DEMO driver as though it was an ADC input. This allows you to visualize the waveform directly, and see the effects of changes in control settings.

## TRIGONOMETRIC RELATIONSHIPS:

``` sin(A) × sin(B) = 1/2 × cos(A-B) - 1/2 × cos(A+B)
cos(A) × cos(B) = 1/2 × cos(A-B) + 1/2 × cos(A+B)
sin(A) × cos(B) = 1/2 × sin(A-B) + 1/2 × sin(A+B)
sin²(A) + cos²(B) = 1
```
GO: