[time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Jim Lux
I need to generate a sequence of pulses at around 1 Hz with a 1/f 
characteristic  (human heartbeat, as it happens). I'd like to do this 
using software and a timer, so I'm looking for a clever algorithm using 
a random number generator to do it.


 I could take the phase noise spectrum and turn that into some form of 
cumulative probability distribution for the period, then generate a 
random number from 0-1 and use the inverse of the CPD to determine the 
period.


But I was wondering if there's some clever way that just happens to 
generate what I'm looking for.  Sort of like how you sum up 12 random 
numbers to generate a Gaussian with variance 1.  and then, the 
Box-Muller algorithm as an alternate way.


A generalized approach for the exponent between 0.5 and 1.5 would be 
useful.


I found some techniques such as building a filter with the required 
power spectral density and then running white noise through it.  There's 
a matlab ( C) package out there called cnoise, as well. cnoise builds 
an array of samples and uses a FFT to do the filtering efficiently.


I'd rather have some sort of difference/recursion equation that I can 
just call each time I need the next interval. I did find some code based 
on a paper by Higham that does what's called the Ornstein-Uhlenbeck 
stochastic difference equation.

dt = tmax / n;
x(1) = x0;
for j=1:n
dw = sqrt ( dt ) * randn;
x(j+1) = x(j) + dt*theta*(mu-x(j)) + sigma * dw

But I don't trust it, because the matlab and c versions do not agree.


1/f^2 (brownian) is easy by taking the random number sequence and 
integrating.


x(j+1) = x(j) + randn(1);
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Bob Camp
Hi

How much horsepower do you have on the gizmo that's doing the generation? For 
instance, is this coming out of an MSP-430 or a Core I-7?

Bob

On Feb 15, 2013, at 7:43 AM, Jim Lux jim...@earthlink.net wrote:

 I need to generate a sequence of pulses at around 1 Hz with a 1/f 
 characteristic  (human heartbeat, as it happens). I'd like to do this using 
 software and a timer, so I'm looking for a clever algorithm using a random 
 number generator to do it.
 
 I could take the phase noise spectrum and turn that into some form of 
 cumulative probability distribution for the period, then generate a random 
 number from 0-1 and use the inverse of the CPD to determine the period.
 
 But I was wondering if there's some clever way that just happens to generate 
 what I'm looking for.  Sort of like how you sum up 12 random numbers to 
 generate a Gaussian with variance 1.  and then, the Box-Muller algorithm as 
 an alternate way.
 
 A generalized approach for the exponent between 0.5 and 1.5 would be useful.
 
 I found some techniques such as building a filter with the required power 
 spectral density and then running white noise through it.  There's a matlab 
 ( C) package out there called cnoise, as well. cnoise builds an array of 
 samples and uses a FFT to do the filtering efficiently.
 
 I'd rather have some sort of difference/recursion equation that I can just 
 call each time I need the next interval. I did find some code based on a 
 paper by Higham that does what's called the Ornstein-Uhlenbeck stochastic 
 difference equation.
   dt = tmax / n;
   x(1) = x0;
   for j=1:n
   dw = sqrt ( dt ) * randn;
   x(j+1) = x(j) + dt*theta*(mu-x(j)) + sigma * dw
 
 But I don't trust it, because the matlab and c versions do not agree.
 
 
 1/f^2 (brownian) is easy by taking the random number sequence and integrating.
 
 x(j+1) = x(j) + randn(1);
 ___
 time-nuts mailing list -- time-nuts@febo.com
 To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
 and follow the instructions there.

___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Jim Lux

On 2/15/13 4:52 AM, Bob Camp wrote:

Hi

How much horsepower do you have on the gizmo that's doing the generation? For 
instance, is this coming out of an MSP-430 or a Core I-7?

Bob



The mighty ArduinoUno...
But it only has to generate one number every second: i.e. I'm simulating 
human heartbeats:  I have a anthropomorphic dummy that has air bladders 
for lungs and heart that we use to simulate a human for radar testing. 
The Arduino just uses timers to open and close solenoid valves to create 
the right frequency and amplitude of motion. Right now it has a somewhat 
unrealistically uniform pulse rate.


There's some faster cheap processors out there that I could drop in, as 
well: teensy3 with the 48MHz Cortex is pretty powerful.






On Feb 15, 2013, at 7:43 AM, Jim Lux jim...@earthlink.net wrote:


I need to generate a sequence of pulses at around 1 Hz with a 1/f 
characteristic  (human heartbeat, as it happens). I'd like to do this using 
software and a timer, so I'm looking for a clever algorithm using a random 
number generator to do it.


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Bob Camp
Hi

Ok, how about a nice simple table? Something in the  500  to  4K entries 
shouldn't  repeat often enough to be noticeable. Each entry probably can be a 
byte. 

Bob

On Feb 15, 2013, at 8:09 AM, Jim Lux jim...@earthlink.net wrote:

 On 2/15/13 4:52 AM, Bob Camp wrote:
 Hi
 
 How much horsepower do you have on the gizmo that's doing the generation? 
 For instance, is this coming out of an MSP-430 or a Core I-7?
 
 Bob
 
 
 The mighty ArduinoUno...
 But it only has to generate one number every second: i.e. I'm simulating 
 human heartbeats:  I have a anthropomorphic dummy that has air bladders for 
 lungs and heart that we use to simulate a human for radar testing. The 
 Arduino just uses timers to open and close solenoid valves to create the 
 right frequency and amplitude of motion. Right now it has a somewhat 
 unrealistically uniform pulse rate.
 
 There's some faster cheap processors out there that I could drop in, as well: 
 teensy3 with the 48MHz Cortex is pretty powerful.
 
 
 
 
 On Feb 15, 2013, at 7:43 AM, Jim Lux jim...@earthlink.net wrote:
 
 I need to generate a sequence of pulses at around 1 Hz with a 1/f 
 characteristic  (human heartbeat, as it happens). I'd like to do this using 
 software and a timer, so I'm looking for a clever algorithm using a random 
 number generator to do it.
 
 ___
 time-nuts mailing list -- time-nuts@febo.com
 To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
 and follow the instructions there.

___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Jim Lux

On 2/15/13 5:37 AM, Bob Camp wrote:

Hi

Ok, how about a nice simple table? Something in the  500  to  4K entries 
shouldn't  repeat often enough to be noticeable. Each entry probably can be a 
byte.

Bob


Yes.. that might work..

Or, for that matter, I believe you could do it by randomly selecting a 
time increment from a table with the right distribution.


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Bob Camp
Hi

I was going to suggest picking start and stop points in the table with your 
random number generator, but it's pretty much the same thing. 

If the base rate is 60 bpm, then each spacing is 16.666… ms. My *guess* would 
be that anything past 0.1 ms likely doesn't matter for the base rate. If that's 
all true, then a byte per entry is actually overkill. You might be able to get 
away with 4 bits per entry. There's also no absolute need for a linear coding 
scheme, you could get both good resolution and a small number of bits. That 
might make fiddling the entry points a bit tough though. 

The timing does relate to multiple valves, so it's not quite as simple as a 
single rate. The time delta's for the other stuff are all pretty short, so you 
may or may not be planing to randomly drive them as well.

It all depends on how fanatic you get about the timing ...

Bob
 
On Feb 15, 2013, at 8:50 AM, Jim Lux jim...@earthlink.net wrote:

 On 2/15/13 5:37 AM, Bob Camp wrote:
 Hi
 
 Ok, how about a nice simple table? Something in the  500  to  4K entries 
 shouldn't  repeat often enough to be noticeable. Each entry probably can be 
 a byte.
 
 Bob
 
 Yes.. that might work..
 
 Or, for that matter, I believe you could do it by randomly selecting a time 
 increment from a table with the right distribution.
 
 ___
 time-nuts mailing list -- time-nuts@febo.com
 To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
 and follow the instructions there.

___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Jim Lux

On 2/15/13 6:21 AM, Bob Camp wrote:

The timing does relate to multiple valves, so it's not quite as simple as a 
single rate. The time delta's for the other stuff are all pretty short, so you 
may or may not be planing to randomly drive them as well.

It all depends on how fanatic you get about the timing ...



Not very..
The physical device being driven has one solenoid valve that fills and 
drains the heart bladder.  The radar looks at the gross surface 
movement of the thorax (on the order of 1mm), and we want something that 
isn't perfectly regular and that has some variability (so that the 
algorithms used to detect the heartbeat don't wind up relying on heart 
rate being zero bandwidth).


Rather than just implement something like

interval = 60/bpm + 0.1*rand

I figured if there was an easy way to generate something from a 
realistic distribution, it would be nice.


___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Bob Camp
Hi

I think a simple table approach sounds like the quick / dirty way to go. 

Bob

On Feb 15, 2013, at 9:56 AM, Jim Lux jim...@earthlink.net wrote:

 On 2/15/13 6:21 AM, Bob Camp wrote:
 The timing does relate to multiple valves, so it's not quite as simple as a 
 single rate. The time delta's for the other stuff are all pretty short, so 
 you may or may not be planing to randomly drive them as well.
 
 It all depends on how fanatic you get about the timing ...
 
 
 Not very..
 The physical device being driven has one solenoid valve that fills and drains 
 the heart bladder.  The radar looks at the gross surface movement of the 
 thorax (on the order of 1mm), and we want something that isn't perfectly 
 regular and that has some variability (so that the algorithms used to detect 
 the heartbeat don't wind up relying on heart rate being zero bandwidth).
 
 Rather than just implement something like
 
 interval = 60/bpm + 0.1*rand
 
 I figured if there was an easy way to generate something from a realistic 
 distribution, it would be nice.
 
 ___
 time-nuts mailing list -- time-nuts@febo.com
 To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
 and follow the instructions there.

___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Brooke Clarke

Hi Jim:

Music synthesizers now use sounds recorded from real instruments and play them back.  Why not record a real heart beat, 
maybe different ones from children, men, women, etc.?


Have Fun,

Brooke Clarke
http://www.PRC68.com
http://www.end2partygovernment.com/2012Issues.html

Jim Lux wrote:
I need to generate a sequence of pulses at around 1 Hz with a 1/f characteristic  (human heartbeat, as it happens). 
I'd like to do this using software and a timer, so I'm looking for a clever algorithm using a random number generator 
to do it.


 I could take the phase noise spectrum and turn that into some form of cumulative probability distribution for the 
period, then generate a random number from 0-1 and use the inverse of the CPD to determine the period.


But I was wondering if there's some clever way that just happens to generate what I'm looking for.  Sort of like how 
you sum up 12 random numbers to generate a Gaussian with variance 1.  and then, the Box-Muller algorithm as an 
alternate way.


A generalized approach for the exponent between 0.5 and 1.5 would be useful.

I found some techniques such as building a filter with the required power spectral density and then running white 
noise through it.  There's a matlab ( C) package out there called cnoise, as well. cnoise builds an array of samples 
and uses a FFT to do the filtering efficiently.


I'd rather have some sort of difference/recursion equation that I can just call each time I need the next interval. I 
did find some code based on a paper by Higham that does what's called the Ornstein-Uhlenbeck stochastic difference 
equation.

dt = tmax / n;
x(1) = x0;
for j=1:n
dw = sqrt ( dt ) * randn;
x(j+1) = x(j) + dt*theta*(mu-x(j)) + sigma * dw

But I don't trust it, because the matlab and c versions do not agree.


1/f^2 (brownian) is easy by taking the random number sequence and integrating.

x(j+1) = x(j) + randn(1);
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.




___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Azelio Boriani
I have found this:

1/f noise can be created using random noise generators but it can also be
producted using deterministic functions. One such method is a finite
difference equation proposed by I. Procaccia and H. Schuster

at http://paulbourke.net/fractals/noise/

On Fri, Feb 15, 2013 at 4:05 PM, Bob Camp li...@rtty.us wrote:

 Hi

 I think a simple table approach sounds like the quick / dirty way to go.

 Bob

 On Feb 15, 2013, at 9:56 AM, Jim Lux jim...@earthlink.net wrote:

  On 2/15/13 6:21 AM, Bob Camp wrote:
  The timing does relate to multiple valves, so it's not quite as simple
 as a single rate. The time delta's for the other stuff are all pretty
 short, so you may or may not be planing to randomly drive them as well.
 
  It all depends on how fanatic you get about the timing ...
 
 
  Not very..
  The physical device being driven has one solenoid valve that fills and
 drains the heart bladder.  The radar looks at the gross surface movement
 of the thorax (on the order of 1mm), and we want something that isn't
 perfectly regular and that has some variability (so that the algorithms
 used to detect the heartbeat don't wind up relying on heart rate being zero
 bandwidth).
 
  Rather than just implement something like
 
  interval = 60/bpm + 0.1*rand
 
  I figured if there was an easy way to generate something from a
 realistic distribution, it would be nice.
 
  ___
  time-nuts mailing list -- time-nuts@febo.com
  To unsubscribe, go to
 https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
  and follow the instructions there.

 ___
 time-nuts mailing list -- time-nuts@febo.com
 To unsubscribe, go to
 https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
 and follow the instructions there.

___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


[time-nuts] source for new Resolution T

2013-02-15 Thread Paul
I'd like to buy a new Resolution T and I'm not having a great deal of
success getting a retail (quantity one) vendor from Trimble.  Anyone
have a typical on-line source (e.g. Diamond Point) in the US?

--
Paul
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


Re: [time-nuts] Generation of pulse train with 1/4 noise

2013-02-15 Thread Magnus Danielson

Jim,

On 02/15/2013 03:56 PM, Jim Lux wrote:

On 2/15/13 6:21 AM, Bob Camp wrote:

The timing does relate to multiple valves, so it's not quite as simple
as a single rate. The time delta's for the other stuff are all pretty
short, so you may or may not be planing to randomly drive them as well.

It all depends on how fanatic you get about the timing ...



Not very..
The physical device being driven has one solenoid valve that fills and
drains the heart bladder. The radar looks at the gross surface
movement of the thorax (on the order of 1mm), and we want something that
isn't perfectly regular and that has some variability (so that the
algorithms used to detect the heartbeat don't wind up relying on heart
rate being zero bandwidth).

Rather than just implement something like

interval = 60/bpm + 0.1*rand

I figured if there was an easy way to generate something from a
realistic distribution, it would be nice.


There is several ways to produce 1/f noise. It seems like the option 
that best fits your needs is the lead/lag filtering option, which is 
covered in a few articles from NIST. A fellow JPL colleague of yours 
then worked on it to set it up properly, so the starting state is good.


I'm sure you want to convert the BASIC code into something somewhat more 
modern, but if worse comes to worse, I could probably do that in C for 
you, as I have been thinking about doing it anyways. It's fairly trivial 
stuff.


The key design issue is that you will need to decide how wide range of 
frequencies needs to fit the 1/f slope.


Turns out that the need to simulate this both in digital and analogue 
domain have been a topic since the early 60thies at NBS (now NIST) and 
Jim Barnes did his PhD on it. They then improved on it further. Much of 
that was then used in musical designs for pink noise filtering.


Let me know if you can't find the articles, and I will dig them up for 
you. I should be able to find them for you before I get to LA.


Cheers,
Magnus
___
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.