C:/Musimathics_local/Musimat/MusimatChapter9/C091704b.cpp File Reference

#include "MusimatChapter9.h"

Go to the source code of this file.

Functions

 MusimatChapter9Section (C091704b)
Real brownian (Real x, Real w, Real B)
Static Void PlotPoint (Real x, Real y)
Static Void para1 ()


Function Documentation

Real brownian ( Real  x,
Real  w,
Real  B 
)

Definition at line 13 of file C091704b.cpp.

References Random().

00013                                      {
00014         Real R;
00015         Do {
00016                 R = x + Random( -w, w );
00017         } While ( R > B Or R < -B );
00018         Return R;
00019 }

MusimatChapter9Section ( C091704b   ) 

Definition at line 2 of file C091704b.cpp.

References para1().

00002                                  {
00003 Print("*** Brownian Nose Generator ***");
00004 /*****************************************************************************
00005 
00006 Brownian Nose Generator
00007 
00008 Here is a simple Brownian number generator (F. R. Moore 1990):
00009 *****************************************************************************/
00010         para1(); // Step into this function to continue.
00011 }

Static Void para1 (  ) 

Definition at line 28 of file C091704b.cpp.

References brownian(), PlotPoint(), and x.

00028                     {
00029 /*****************************************************************************
00030 Parameter x is either the initial value of the random walk or the value last calculated by brownian(). 
00031 Parameter w is called the window parameter because it determines the maximum amount by which 
00032 the value of x can change at one time. Parameter B is the bounds, limiting the Brownian motion 
00033 to within its range. This method departs from strict Brownian motion by retrying the random 
00034 choice until the new value lies within this range.
00035 
00036 We call the brownian() method each time we want a new Brownian number, passing it either 
00037 an initial value or the value of its previous output. For example, the following code generated the 
00038 function shown in figure 9.30.
00039 *****************************************************************************/
00040 
00041 Real x = 0.0;
00042 Real y = 0.0;
00043 
00044 For (Integer i = 0; i < 1000; i = i + 1) {
00045         x = brownian(x, 0.5, 0.5);
00046         y = brownian(y, 0.5, 0.5);
00047         PlotPoint(x, y);        // plot a point on a graph at location [x, y]
00048 }
00049 
00050 /*****************************************************************************
00051 A Brownian noise signal and its power spectrum on a log-log plot are shown in figure 9.31. The 
00052 straight line in the figure traces the contour of 1/(f*f) for reference.
00053 *****************************************************************************/
00054 }}

Static Void PlotPoint ( Real  x,
Real  y 
)

Definition at line 21 of file C091704b.cpp.

00022 {
00023         //Note, this function is a placeholder for the appropriate
00024         //graphics function call on your platform to plot a point
00025         //on a graph.
00026 }


Generated on Fri Sep 8 23:11:09 2006 for Musimat Chapter 9 Code Examples by  doxygen 1.4.7