Waveform generation

Abstract: Apparatus for generating waveforms comprising a calculator (1) operable to generate a succession of output values which consist of solutions to a stored generator equation. In one embodiment the generator equation has the inverse of a trigonometric function as its argument. By combining mathematical functions to form different generator equations, a vast number of waveform shapes can be generated. The invention has applications in waveform synthesis for musical instrumentations, modulators, adaptive control systems, etc.

Description: This invention relates to methods and apparatus for generating waveforms. There are many known techniques currently employed for generating waveforms. One technique is that of frequency synthesis which may involve the direct or indirect generation of a sine wave at a required frequency from a reference derived from a crystal oscillator. Direct frequency synthesis employs multiplication, mixer and divider circuits, whereas indirect synthesis employs phase-locked loop techniques. Both methods are therefore somewhat complicated to realise. Alternative, digital forms of frequency synthesis obviate the need for complicated analogue circuitry but require large digital memories. A reference clock frequency is also required for this method in which a number representing the phase change per clock period is shifted into an accumulator on each clock cycle. The accumulator's output is an approximation of a linear phase versus time function which is then converted to analogue form by a digital to analogue converter (DAC). The reader is referred to "Frequency Synthesis by Phase Lock" by W. F, Egan (J. Wiley 1981) for detailed descriptions of synthesiser circuitry. Other less complicated yet less precise and stable waveform generator circuits are to be found described in many standard electronic text books. For example, a square and triangular wave ascillator can be simply realised using a two-operational amplifier circuit. In a further example, an integrated circuit including a counter generates square waves which can be converted to an approximate sine wave by passing the square-wave signal through a fifth order band-pass filter. Some dedicated circuits employ digital Fourier techniques ie a digital expander expands a square wave into a variety of digital forms. These are summed to give a staircase approximation to the desired sine wave output, which is smoothed by a low-pass filter. The present invention aims to provide a method and apparatus for waveform generation which has none of the inherent complication of a synthesis method yet does not sacrifice precision or stability in order to achieve simplicity. The invention has arisen as a result of a discovery by the inventor, that discovery relating to the behaviour of computers and calculators particularly concerning the calculation of trigonometric values. To assist the understanding of the invention, a resume of the discovery and the definition of a new set of trigonometric functions will now be given with reference to figures 1 to 6 of the drawings. Computations performed on, for example, hand-held calculators, personal computers, main-frame computers, which involve trigonometric functions acted upon by their own inverses yield surprising results. For example, if the calculation arc sin (sin 89°) is performed on a calculator, the answer will be 89°. However, arc sin (sin 91°) will also be displayed as 89°. Arc sin (sin 135°) will be displayed as 45° and arc sin (sin 180°) will be displayed as 0, ie arc sin (sin ) is not always equal to . The same phenomenon occurs for the computations of arc cos (cos ) and arc tan (tan ) and the reader can readily verify this using a calculator. Calculation of trigonometric functions can be done in a variety of ways, either by using look-up tables or by summing terms in a power series. Some methods and algorithms for computing inverse trigonometric functions are described in US 4,899,302. Inverse trigonometric functions are multivalued and in overcoming the ambiguity, computer algorithms produce the behaviour exemplified in Figures 1 to 3. Figures 1, 2 and 3 show plots of an angle "" versus a function "y" where in Fig. 1, y = arc sin (sin) and -π ≤  ≤ π in Fig. 2, y = arc cos (cos) and -2π ≤  ≤ 2π and in Fig. 3, y = arc tan (tan) and - π ≤  ≤ π The functions on the ordinate axis of each plot (of Figures 1 to 3) are henceforth referred to as "Portmanteau" functions of the first kind and will be abbreviated to the form, P S (), P C () and P T () where: P S () ≡ Parcsine  ≡ arcsin (sin ) P C () ≡ Parcosine  ≡ arccos (cos ) P T () ≡ Parctangent  ≡ arctan (tan ) Portmanteau functions of the first kind have an argument which is an angle (in radians or degrees). They convert an angle to an angle. As can be seen from Figure 1, P S () is an odd, bipolar, triangular periodic function. Note also that: P S () = P S ( + 2πn) where n is an integer. Figure 2 shows that P C () is an even, unipolar, triangular periodic function. It will be noted that: P C () = P C ( + 2πn) and that P C () = P S ( - π / 2 ) + π / 2 Figure 3 shows that P T () is an odd, bipolar ramp, periodic function with discontinuities at nπ / 2 , where n is an odd integer. It has been observed that not all calculating machines deal with arctan (tan 90°) in the same way: some will register an error, whereas others will display 90°. Note that: P T () = P T ( + πn). The inventor has found that most, if not all calculating machines will exhibit the behaviour illustrated in Figures 1, 2 and 3. The invention exploits that behaviour by arranging for Portmanteau functions to be used in waveform generating apparatus to be described below. Derivatives of Portmanteau functions of the first kind will also be shown to have uses in waveform generation. In Figure 4,  v dP / dS () is plotted. Note that: dP d S () ≡ cos √cos 2  ≡ cos cos The above expression dP / dS () is identical with sgn (cos ), where sgn x is +1 for positive values of x, -1 for negative values of x 0 for x = 0 A computer for calculating dP / dS () or sgn (cos ) would produce the waveform of Figure 4 for values of  ranging from -π to +π. This waveform is a square wave of amplitude equal to 1. Further functions, useful in assisting understanding of the invention will now be discussed with reference to Figure 5 and 6. Portmanteau functions of the second kind may be written in the following general terms: P S [f(x)] ≡ arc sin [sin(f(x))] P C [f(x)] ≡ arc cos [cos(f(x))] P T [f(x)] ≡ arc tan [tan(f(x))] where f(x) is any arbitrary function of x, and not necessarily a trigonometric function. Figure 5 is a plot of x v P S (x 2 ). The central parabola is centred on the origin and behaves in a similar way to a plot of y=x 2 , but the y value cannot go beyond π/2. This limit is reached at x= π/2 . Portmanteau functions of the third kind are functions having a "split" argument by interposing a variable 'A' in a Portmanteau function as follows. eg arc sin [A sin (sin )] arc cos [A cos (sin )] arc tan [A tan (sin )] or arc sin [A sin ] arc cos [A cos ] arc tan [A tan ] where A can be any number. Figure 6 shows an example of the behaviour Portmanteau function of the third kind as the value A is varied from 0.5, to 1, to 2. It can be seen from the Figure that sinusoids and triangular waveforms can be generated using this function. A waveform generator and corresponding method according to this invention are defined in claims 1 and 8. Said apparatus could be realised using digital or analogue circuitry. If the output values are in digital form, then the means for supplying output values in succession could be a DAC, clocked at a desired rate. The generator equation could be stored in a memory, to which the calculator means has access. The set of input values could also be stored in a memory and clocked into the calculator means at a desired rate. The generator equation may have the form y = sgn (cos x) for example as previously described herein with reference to Figure 4. Thus, the waveform generator embodied in this way would generate a square wave, by clocking into the calculating means, successive values of x between say -π and +π radians. Repeating this sequence would produce a continuous waveform. In another example, the generator equation could be one of the Portmanteau functions previously described. Alternatively, combinations of Portmanteau functions and other functions are envisaged, such as, for example, y = ( 1 2 + sgn x)e -x .P C (x) Fourier terms may also be combined with Portmanteau functions, for example, the generator equation could have the form y = P S (x)-sin x + 1 9 sin 3x. It will be appreciated that a vast number of waveforms can be created using apparatus in accordance with the invention. The hardware required to realise the invention is minimal and uncomplicated. A calculating machine, pre-programmed to calculate the desired function and interfaced with a DAC are the basic constituents of the apparatus. All commonly used algorithms for calculating inverse trigonometric functions may be employed by the calculator means for generating the Portmanteau functions. Although a calculator with keyboard and a DAC are convenient modules for demonstrating the invention, the method lends itself to incorporation in dedicated integrated circuits (or ASICs). Such integrated circuits could find uses in all manner of applications, eg waveform generators for electronic musical instruments, modulators, pulse (time-base) generators, waveform generators for adaptive control systems, etc. Some embodiments of the invention will now be described by way of example only with reference to Figures 7 to 28 of the drawings of which: Figure 7 is a block diagram of apparatus in accordance with a first embodiment of the invention; Figures 8 to 18 show examples of waveforms which are capable of being generated by the apparatus of Figure 7. Figure 19 is a block diagram of apparatus in accordance with a second embodiment of the invention; Figures 20 and 21 show examples of waveforms which are capable of being generated by the apparatus of Figure 19; and Figures 22 to 28 show further examples of waveforms which can be generated using methods in accordance with the invention. In Figure 7 a calculator 1 has inputs from a memory 2 and a store 3. The calculator has an output connected to a DAC 4. The DAC has a clock input 5 whose rate may be varied. The memory 2 has stored therein a plurality of generator equations which are separately addressable via an address line 6. The store 3 contains discrete values of a parameter forming an argument of a generator equation appearing on the output of the memory 2. In a first example, the generator equation y = P S [ 3π 4 sin ] is selected and output from the memory 2 to the calculator 1. The calculator 1 is programmed with the necessary algorithms to calculate successive values of y for a multiplicity of values of  lying between -π and +π and repeat this calculation as many times as desired. The discrete values of  are held in the store 3 and clocked into the calculator 1 in succession. Each successive output value of y (in digital form) is latched into the DAC 4. The DAC 4 makes the conversion to analogue form and clocks out analogue data at a rate which is controlled by the clock input 5. Thus the frequency of the resulting waveform can be selected by modifying the clock rate on the clock input 5. A greater number of  values between its limits will give a smoother waveform than a lesser number. Alternatively, the clock rate of the DAC 4 may be fixed at a constant value and the frequency of the output waveform varied by changing the value of the argument of the generator equation as appropriate. A combination of the two alternatives is also possible. Figure 8 shows the type of waveform which can be generated using the function y = P S [ 3π / 4 sin ]. Figure 9 shows the waveform generated for the function y = P T ( 3π 4 .sin ) The versatility of the apparatus of Figure 7 will now be appreciated. Further examples reveal how Portmanteau functions can be combined with other mathematical functions to yield useful waveforms. Figure 10 shows the transient, decaying waveform obtainable for the function: y = ( 1 2 + sgn ).e - .P C () Using combinations of products, sums or differences of first derivatives of Portmanteau functions, almost any periodic waveform can be constructed. Suitable co-efficients can produce any amplitude, mark-space ratio, DC offset or polarity. The rectangular pulse waveform of Figure 11 can be generated by using a function of the form: y = A sgn.(cos Bx).sgn [cos B(x-t)+P] The embodiments thus far described have related to the generation of periodic waveforms. By applying the appropriate generator equation to the calculator 1, the apparatus is capable of generating most, if not all waveforms capable of being synthesised by known Fourier methods. Considering singularity functions, there are two conventional ways of dealing with them: (i) By "piecewise continuity" (ii) By Fourier synthesis The first way is not ideal, being little more than a description: "The function has this value from there to there and another value from there to somewhere else .....etc". The second way involves addition of a series of trigonometric terms or the evaluation of an integral. Approximation errors will be present due to the finite number of terms used or the finite range of integration. (Truncation errors). Fourier analysis is a convenient way of producing a set of orthogonal functions for mapping between two domains. eg time and frequency etc. Portmanteau functions offer an alternative method of waveform synthesis without truncation errors. In addition they offer a means for developing a waveform synthesis algebra. Note however that no algebraic method could be expected to produce values at the edge of a zero risetime pulse. For example, a more reasonable objective would be to develop formulae which describe the waveforms, at all points except the singularities. We would expect the formulae to describe, to generate and to become suitably indeterminate at the singularities. Because of the far sightedness of computer language authors there is no shortage of methods of dealing with indeterminacies. Part of a waveform synthesis method has already been described. Portmanteau functions of the first and second kinds can be used to generate a variety of trapezoids, triangles, ramps, rectified sine waves and other shapes with and without discontinuities. Square waves can be synthesised using derivatives of Portmanteau functions. The apparatus of Figure 7 is also capable of generating aperiodic singularity functions and frequency-modulated waveforms. A universal waveform synthesis capability requires the generation of "one shot" or non periodic signals. Almost any arbitrary signal can be built from combinations of periodic and non periodic signals. A very important tool for constructing non periodic signals is the Heaviside function or unit step. The piecewise definition is: u(t - ) = 0 (-∞ < t < o) u(t + ) = 1 (O < t < +∞) Existing mathematics texts still use this piecewise description or their Fourier and Laplace equivalents. An alternative form is given below: u(t) = 1 2 (1 + t t ) The function describes, generates and becomes indeterminate at t = 0. Different software exhibits a variety of responses to singularities, poles etc. It is a simple matter to build an "error trap" for t = 0. The "signum" function (SGN) is a more elegant solution. SGN(-N) = -1 SGN(+N) = +1 Where N is any real number SGN(O) = 0 The step generator function can be re-written thus: U(t) = 1 2 (1+SGNt) This alternative form returns values of 0 in the left half plane, +1 in the right half plane and + 1 / 2 at t = 0. In effect, the function accomplishes a "normalised" unit step, originally proposed by Heaviside as a way of dealing with singularity at zero. Heaviside's piecewise description for a normalised unit step was: The SGN function is incorporated into most computer languages. Its presence is a testament to the skilful way in which the problems of singularity were apparently anticipated by the language authors. Applying the step generator function will permit almost any aperiodic signal to be synthesised. As an example an aperiodic symmetric pulse may be generated by the function: y = 1 2 [sgn (+1) - sgn (-1)] (See Figure 12). As with the periodic generators, the aperiodic generators can be adjusted. Suitable coefficients allow time shifting, asymmetry and different amplitudes etc. In a further example, consider the use of a delta function. The delta function is normally given a piecewise description and a integral definition: Another definition is: δ(t) = d dt {u(t)} There are analytical and practical difficulties connected with developing generator equations for δ(t). A more useful function can be defined and implemented by the calculator 1. This is the "trigger function": The function can be implemented in several forms, aperiodic and periodic. One method of implementing an aperiodic trigger function is to shrink the width of a pulse. Figure 13 shows a plot of the function y = 1 2 [sgn (+t) - sgn (-t)] for t = 0.005. A periodic trigger function can be made to trigger at the zeroes of the Parcosine function at intervals of 2π by using the function y = e -k arc.cos (cos) (See Figure 14). An arbitrary function eg f(x) = x n say, can be multiplied by a first kind Portmanteau. The combined result will be a periodic version of x n+1 over a bounded range. The range of the combination will be determined by the amplitude and period of the Portmanteau. The period of the combination will be related to the period of the Portmanteau. It has already been mentioned that the invention embodied by the apparatus of Figure 7 can be used to generate frequency modulated waveforms. Figures 15 and 16 show two such examples. The generator equations solved by the calculator 1 in these cases are, respectively: y = sin [AP C (B)] and y = sin [AP C (B) 2 ] where A and B are constants. Figure 15 shows a linear FM chirp waveform, and Figure 16, a parabolic FM chirp waveform. It is interesting to compare waveform synthesis by the method according to the invention with Fourier methods. For example, to synthesise a square wave, the function y = π 4 sgn (sin ) can be used. An approximation to a squarewave can also be synthesised using Fourier components, eg the first six terms being: y = sin  + 1 3 sin 3  + 1 5 sin 5  + 1 7 sin 7  + 1 9 sin 9  + 1 11 sin 11  Figure 17 compares the waveform obtained using the generator equation y = π 4 sgn (sin ) (curve A) with the waveform obtained by summing the above Fourier terms (curve B). The distortion on curve B can be clearly seen whereas there is no distortion on curve A which shows a clean square wave free from ripple. A similar comparison can be made in the case of a ramp waveform. In Figure 18, curve A shows the waveform obtained using the generator equation y = P T (  / 2 ) Superimposed is curve B, which is the waveform obtained by summing the Fourier terms: y = sin  - 1 2 sin 2  + 1 3 sin 3  - 1 4 sin 4  + 1 5 sin 5  - 1 6 sin 6  Again distortion can be seen on curve B. Reducing distortion may be done by adding more Fourier terms, but this adds to the total computation time which may be a disadvantage in some applications. In some applications it may be desirable to deliberately introduce some distortion into a waveform. This can be done using, for example, the second embodiment of Figure 19. This embodiment is the same as that of Figure 7 except for the addition of a further memory 7. In this memory 7 are stored a series of Fourier terms, which can be accessed by the calculator 1. In operation, the calculator 1 computes successive values of the solution to the generator equation stored in the memory 2 (as performed by the first embodiment). However, before outputting these successive values to the DAC 4, it subtracts or adds (depending on how it has been pre-programmed) one or more of the Fourier terms stored in the store 7. As an example, Figure 20 shows the waveform which can be obtained when the calculator 1 is arranged to solve the equation y = π / 4 P S (x) - sin x for successive values of x. The Portmanteau term π / 4 P S (x) is stored in the memory 2 and the Fourier term - sin x is stored in the store 7. A second example (Figure 21) shows a distorted square wave. This can be formed by computing y = π 4 sgn (sin x) + 1 11 sin11x This treatment of the original generator equation (ie strengthening one of the harmonics of the square wave) produces a "ringing" distortion. It will be appreciated that the number of distorted waveforms which can be produced by this method is vast, Figures 20 and 21 showing merely two typical examples of what can be achieved. The remaining examples of Figures 22 to 28 show waveforms such as trapezoids and clipped sine-waves which can be generated by the methods of the invention hereinbefore described. These examples by no means define the limits of invention, but are included in order to illustrate its utility.

Claims: A waveform generator comprising: calculator means (1) operable to receive a set of input values which form an argument of a generator function and to create a sequence of output values each comprising the calculated result of a generator equation which includes said generator function; and means (4) for supplying the output values in succession to define successive segments of a waveform, characterised in that the generator function comprises a Portmanteau function, which Portmanteau function is defined as the inverse trigonometric function of a trigonometric function or a derivative of the inverse trigonometric function of a trigonometric function. The waveform generator as claimed in Claim 1 in which the Portmanteau function, P(), is of the form P() = arc trig [trig ]. The waveform generator as claimed in Claim 1 in which the Portmanteau function is of the form P[f(x)], where P[f(x)] = arc trig [trig(f(x))] and f(x) is any function of x, and trig = sin, cos or tan. The waveform generator as claimed in Claim 1 in which the Portmanteau function, P(), is of the form P() = arc trig [A trig ] or P() = arc trig [A trig (trig )] where trig = sin, cos or tan, A is a variable, and  is an angle. The waveform generator as claimed in Claim 1 in which the Portmanteau function is defined as dP()/d, where P() = arc trig [trig ], and trig = sin, cos or tan and  is an angle. The waveform generator as claimed in any preceding Claim and including a second memory (2) connected to the calculator means (1) for storing the generator equation. The waveform generator as claimed in any preceding Claim and including a third memory (3) connected to the calculator means (1) for storing the set of input values. A method for generating waveforms comprising the steps of: receiving a set of input values which form an argument of a generator function; creating a sequence of output values each comprising the calculated result of a generator equation which includes said generator function corresponding to each input value; and outputting the output values in succession to define successive segments of a waveform, characterised in that the generator function comprises a Portmanteau function, which Portmanteau function is defined as the inverse trigonometric function of a trigonometric function or a derivative of the inverse trigonometric function of a trigonometric function. A method for generating waveforms as claimed in Claim 7 or 8 in which the generator function includes a term comprising the inverse trigonometric function of a trigonometric function. A method for generating waveforms as claimed in Claim 7, 8 or 9 including the step of modifying the generator equation by the addition of a Fourier term to the Portmanteau function.

Inventors: HOLNESS PETER JOHN, HOLNESS, PETER JOHN
Applicants: HOLNESS PETER JOHN, HOLNESS, PETER JOHN
Application year: 1992
Main classification: G06F17
IPC codes: G06F17, H03B28, G06F7