16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

332 CHAPTER 8. NONLINEAR DIAGNOSTIC TOOLS<br />

8.2.1 Frank N. Stein's Heartbeat<br />

The more powerful and original a mind, the more it will incline<br />

towards the religion of solitude.<br />

Aldous Huxley, British writer (1894{1963)<br />

Let's ¯rst illustrate how the power spectrum is calculated for a simple example.<br />

We are given Frank N. Stein's steady heartbeat described by<br />

2X<br />

x = Ai sin(2 ¼fit); i=1<br />

with fundamental frequency f1 = 1 beat per second (60 beats per minute) and<br />

a small second harmonic f2 = 2 beats per second. The suitably normalized<br />

amplitudes are A1 =1andA2 =0:4. Pretending that we do not know the<br />

frequencies, we will extract them from the power spectrum. (We could be<br />

dealing with experimental data, not a known analytic form.)<br />

To calculate the discrete Fourier transform, the DiscreteTransforms package<br />

must ¯rst be loaded. The number of sampling points is taken to be N = 1000.<br />

The numerical factor d = 10 will be used to determine the sampling time.<br />

> restart: with(DiscreteTransforms): N:=1000: d:=10:<br />

The parameter values are entered and the time T2 =1=f2 is calculated.<br />

> A[1]:=1: A[2]:=0.4: f[1]:=1: f[2]:=2.0: T[2]:=1/f[2];<br />

T2 := 0:5000000000<br />

An operator is formed to calculate x at a speci¯ed time t.<br />

> x:=t->add(A[i]*sin(2*Pi*f[i]*t),i=1..2):<br />

Then, x(t) is plotted over the time interval t =0todT2.<br />

> plot(x(t),t=0..d*T[2],labels=["t","x"]);<br />

x<br />

1<br />

0.5<br />

0<br />

–0.5<br />

–1<br />

1 2 3 4 5<br />

t<br />

Figure 8.8: Frank N. Stein's heartbeat.<br />

If one were given only the plot shown in Figure 8.8, it would not be obvious<br />

exactly what frequencies are contained in Frank's heartbeat. The power spec-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!