• Aucun résultat trouvé

Problem 3.3 Consider the two-mass and three-mass systems of the previous problem, under the

Dans le document Numerical Sound Synthesis (Page 80-84)

The oscillator

PROBLEMS 69 Problem 3.3 Consider the two-mass and three-mass systems of the previous problem, under the

simplified conditions thatK1=K2= · · · =K0 andM1=M2= · · · =M0, for positive constants K0andM0. For each of cases (a) and (b) shown in the figure, explicitly find the eigenvalues of the matrixM−1Kand, thus, the frequencies of the system, as per(3.11).

Problem 3.4 For the scheme (3.12), consider the following approach to initialization to second-order accuracy. For a continuous-time function u(t ) solving (3.1), it is true, through a Taylor series expansion, that

u(k)=u(0)+kdu dt

t=0+k2 2

d2u dt2

t=0+O(k3)

Given the valuesu(0)=u0anddu/dt|t=0=v0, determine, from the above approximation as well as the defining equation of the SHO,u(k)in terms ofu0andv0. This can be used to set the value u1in the resulting difference scheme.

Problem 3.5 For scheme (3.12), under the condition (3.17), prove that the bounds (3.19) and (3.24) obtained using frequency domain analysis and energetic techniques, respectively, are identical.

Problem 3.6 For the scheme(3.25), find a bound on the solution size in terms of the initial con-ditions andω0, through the expressions for the energy given in(3.28). The discussion of quadratic forms in Section 2.4.3 may be of use here.

Problem 3.7 For the scheme (3.29), (a) write the characteristic polynomial in z and prove the stability condition(3.30), and (b) show that the expression given in(3.31)is indeed a conserved energy and find conditions under which it is non-negative.

Problem 3.8 The deviation in cents of a frequency f (in Hertz) from a reference frequencyf0 is defined as

deviation in cents=1200 log2(f/f0)

Find an explicit expression for this deviation in the case of schemes (3.12) and (3.25). Recall thatf =ω/2π is the frequency of oscillation of the scheme, andf0=ω0/2π is the “reference”

frequency of the underlying SHO. For a sample rate offs=44 100Hz, find the lowest reference frequency f0 at which the absolute value of this deviation is equal to 100cents (one semitone) and10cents (one-tenth of a semitone). For scheme(3.29), with a value ofα=0.82, what is the minimum value of this deviation over the bandf0∈[0, fs/4]?

Problem 3.9 For difference scheme (3.43)for the coupled system of oscillators, left-multiply by the vectorδuT, and show that the following numerical energy is a conserved quantity:

h=t+v with t= 1

2t−uT)M(δt−u) v= 1

2uTKet−u You may assume thatMand Kare symmetric.

Generalize the energy analysis of the simple difference scheme for the harmonic oscillator in Section 3.2.6. Can you show that the energyhabove is positive definite under the condition(3.44) obtained through frequency domain analysis?

Problem 3.10 Consider the scheme(3.45)for the coupled system(3.9).

(a) Show that it may be written in the form

un+1=A1Bunun−1

and find the matricesA and Bexplicitly in terms of M, K, the free parameterα, and the time step k.

(b) Show that, for symmetricKand M, an energy function of the formh=t+vis conserved, with

t= 1

2t−uT)M(δt−u) v= α

2uTKet−u+1−α 2 μt−

uTKu

Problem 3.11 Find a general real-valued solution to(3.46)under the conditions (a)σ0=ω0and (b)σ0> ω0. Determine the values of any constants in terms of initial conditions. Are these situations that you would expect to find in a practical acoustics setting? Discuss.

Problem 3.12 Consider the energetic analysis of the simple harmonic oscillator with loss, as described in Section 3.5.1. Note that althoughH(t )will be monotonically decreasing in the case of linear loss, by(3.49), the specifics of its rate of decay are unclear. To this end, define the function H¯ by

H¯ =H+σ0udu dt =1

2 du

dt 2

+ω20

2 u2+σ0udu

dt (3.65)

Note thatapproachesHin the limit asσ0→0.

(a) Show that

d

dt = −σ0H¯ −→ H(t )¯ =e−σ0tH(0)¯ (3.66) Thusdecays exponentially, at decay rateσ0, for any value ofσ0.

On the other hand,H, in contrast to¯ H, is not necessarily a non-negative function of the state u anddu/dt. This non-negativity property is crucial in obtaining bounds such as(3.8).

(b) Show that the conditionσ0< ω0leads to H¯ ≥ ω20σ02

2 u2

Show further that under such conditions, one has, from the above inequality, that

|u(t )| ≤ 1 ω1

2 ¯H(t )≤ 1 ω1

2 ¯H(0) for t≥0

(c) Show that the bounding quantity on the right of the above inequality is in fact identical to C1, and thus the bound above is identical to(3.48)obtained using frequency domain analysis.

Problem 3.13 Consider the expression (3.53)for the roots of the characteristic polynomial for the difference scheme(3.51)of the simple harmonic oscillator with loss.

(a) Supposing that the stability condition(3.54)is respected, find the conditions under which the solutions are either both real or complex conjugates.

(b) Again supposing that the stability condition(3.54)is respected, what form do the roots take whenσ0>1/ k? What kind of solution will be produced, and will it be physically reasonable?

Problem 3.14 Considering scheme (3.57) of the simple harmonic oscillator with loss, derive the stability condition (3.59)by using the condition (2.14). Derive the characteristic polynomial equation and a similar condition for the following scheme, which makes use of a forward difference approximation to the loss term:

δt tu= −ω20u−2σ0δt+u

PROGRAMMING EXERCISES 71 Problem 3.15 Consider the following approximation to the lossy simple harmonic oscillator (3.46):

δt tu= −ω02μt·u−2σ0δt·u (a) Show that the scheme is unconditionally stable.

(b) Calculate the numerical decay time for this scheme, under low-loss conditions, and show that it will be dependent onω0.

Problem 3.16 Considering the exact two-step recursion(3.62)for the simple harmonic oscillator with loss (3.46), it is reasonable to expect that it may be written in standard operator notation.

Consider the following scheme, which depends on the two parametersφandσ0: δt tu= −ω20+(1φ)μ) u−2σ0δu

Find settings forφandσ0in terms ofω00, and k and show that the scheme above is equivalent to(3.62)under low-loss conditionsσ0< ω0.

Problem 3.17 Consider the finite difference scheme for the oscillator given by un+M−2un+un−M = −ω20(Mk)2un

whereM≥1is an integer, and k, as before, is the time step.

(a) Show that this difference scheme approximates the simple harmonic oscillator to second-order accuracy in the time step k.

(b) Find the characteristic polynomial for this scheme, and a stability condition on k, the time step.

(c) Find the roots of the characteristic polynomial and thus the natural frequencies of the scheme.

Show that one of these approachesω0.

(d) Is this a useful approximation to the simple harmonic oscillator? Discuss.

(This is an illustration of a digital structure which is capable of producing many frequency components, though the operation count is the same as that of a single oscillator. This is the same principle which underlies the digital waveguide—see Section 1.2.3.)

Problem 3.18 For scheme(3.64), for the simple harmonic oscillator with a source term, perform energy analysis analogous to that of the model equation (3.63), and find a bound on the size of the solutionun in terms of initial conditions, and the values of the time series[F]at time steps between0and n.

3.8 Programming exercises

Programming Exercise 3.1 Adjust the code provided in Section A.1 such that only two memory locations are required in order to represent the state of the scheme (3.12)for the simple harmonic oscillator. This is slightly trickier than it appears to be—a hint is that you may wish to break the time seriesuninto two sets, containing values for n odd and even.

Programming Exercise 3.2 Create two Matlab scripts which generate output according to the difference scheme family(3.29)and the exact scheme(3.39). The parameters which should be set in the preamble to your code should be:fs, the sample rate,Tf, the total duration of the simulation, in seconds,f0, the reference frequency of the simple harmonic oscillator, in Hertz,u0, the initial displacement of the oscillator, and v0, the initial velocity. For the script corresponding to the

family(3.29), the additional parameterαmust be specified. In this case, be sure to perform a test for numerical stability involvingfs,f0, andα, and create an error message if it is violated. Your code should create plots of: the oscillator output as a function of n, the time step, the potential, kinetic, and total energy vn, kn, andhn as a function of n, as well as the variation in energy, i.e.,(hn−h0)/h0. You may wish to use the Matlab code provided for the simple scheme (3.12)in Section A.1 as a reference.

Programming Exercise 3.3 Adjust the code provided in Section A.1 such that, in addition to the output of the difference scheme, the exact solution to the differential equation (3.1)is generated, at the sample rate specified. Your code should play both outputs in succession. At a given sample rate such asfs, find the smallest value of the reference frequencyf0such that the frequency of the output of the difference scheme is perceptually distinct from that of the exact solution. Try typical values of the sample rate used in audio applications, such asfs=32 000,44 100, or48 000Hz.

Programming Exercise 3.4 Program the wave digital version of the simple harmonic oscillator, as per Section 3.3.3. Show that its behavior is identical to that of the scheme (3.29), under the choice ofα=1/2. In order to do this, you will need to ensure that both methods are initialized in corresponding ways.

Programming Exercise 3.5 Consider the two-mass system shown at left in Problem 3.2 above, with M1=1, M2=0.0001, K1=1000, K2=5000, andK3=10 000. Write Matlab implemen-tations of the schemes (3.43) and (3.45), running at44 100Hz, and using a parameter value of α=0.82 in the second case. Your code should calculate 1 s worth of output of the displace-mentsu1andu2, and plot the spectrum magnitude of each such output. Compare the characteristic frequencies of the output, in each case, to the exact frequencies of the system (3.9), calculated through (3.11).

Programming Exercise 3.6 Generalize the script provided in Section A.1 for the simple harmonic oscillator by introducing loss, according to scheme(3.51). In your code, you should haveT60as a global parameter, from which the parameterσ0is then derived.

4

Dans le document Numerical Sound Synthesis (Page 80-84)