Quantcast
Channel: EngineerZone: Message List
Viewing all articles
Browse latest Browse all 22030

It's Pi Day -- Compute the approximate value of Pi with SigmaDSP

$
0
0

    Engineers have a bad reputation for abusing things.  For example, power supply magnetics designers often abuse (and sometimes blow up!) audio power amplifiers to test their wound components at odd amplitudes and frequencies.  So, why not abuse a ADAU1701 to approximate the value of Pi on Pi Day.  Pi can be worked out by comparing the area of a unit square with that of an included circle -- the ratio of these is pi / 4.  Often this is done Monte-Carlo style with random number generators -- throw darts at the square and count those that land within the circle inside.  However, the white noise in SigmaDSP, being of Gaussian and not linear distribution, won't work for this. So I did a "raster scan" of two triangle wave generators.  Yes, think of the vertical and horizontal sweeps in the old TV I'm still watching, because it still works.  BTW -- please don't refer to things like my TV or last year's smartphone as a "dinosaur"  -- no need to insult these majestic creatures.

Compute-pi_pic.png

    For each sample interval, the circuit generates a new x,y point and computes its radius.  If less than one, it counts as a "hit" and increases the output, otherwise the output is allowed to decay.  Eventually the output settles to something close to pi.  Obviously, one could do a much better job much faster with a general-purpose computer or last year's smartphone -- but it's more fun to push the tech in unusual directions.


Viewing all articles
Browse latest Browse all 22030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>