LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding low frequency noise to a sine function

Hi,

I'm trying to generate a signal which would represent the torque curve of a cyclist. To be  as close as possible from the real torque curve, I need to add random low frequency noise to my sine. I've managed to add noise to my signal but I can't change the frequency (which is very high...). Anyone got an idea how should I proceed?

 

I add my vi which generate the signal

 

Here is an example of pedaling curve :

Résultat de recherche d'images pour "pedaling graph"

 

Thanks for your help

0 Kudos
Message 1 of 6
(4,364 Views)

You could add a low pass filter to the noise and then add the real signal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(4,358 Views)

Do you have an idea about the frequency content of interest?  If it is something like bicycling data, I'm guessing noise might be frequencies in the range of 2-20 Hz.  I also assume you are sampling at some frequency, let's assume 100 Hz.  So you could do the following:

  • Select 3 to 5 "random" sets of frequency, gain, and phase parameters, where frequencies are chosen to span your "noise" range (you might try initially spacing frequencies logarithmically, then "nudging" them away from their starting point, setting gains randomly over some interval, and having phase be uniform over [0, 2*pi]).
  • At each time point t, calculate a "sum of sines" from your Noise parameters.  Since you've chosen the frequencies "randomly", they should not be multiples, so your waveform will not repeat, but will be "random", with frequencies set by how you set it up.  It does involve calculating 3-5 sines for each data point, but PCs are pretty fast at doing arithmetic ...

Bob Schor

 

P.S. -- I've used a variant on this idea to build a "Sum-of-Sines" stimulus that, several decades ago when computers were a little slower, had no problems producing "random-like" (meaning "unpredictable") smooth stimuli.

0 Kudos
Message 3 of 6
(4,313 Views)

Hi Bob,

Thanks for your answere, but you seems to be way more advanced than me in this domain. Could you try to explain your solution a bit more or eventually send me a .vi example?

 

Tkanks for the help.

 

Robin

0 Kudos
Message 4 of 6
(4,309 Views)

Assume you are sampling a signal at 100 Hz, you think most of the "signal" is around 1 Hz, and you want to add some low-frequency "noise".  What is "noise"?  One definition could be an unpredictable signal, one that you don't want.

 

Let's say our Signal of Interest (here called "Signal") is 5 sin (2 pi 1 t) (amplitude 5, frequency 1 Hz).  Consider the following Signal + Noise:

   Signal + 1.2 sin (2 pi 5.36 t + 1.2) + 1.4 sin (2 pi 7.34 t + 0.3) + 0.9 sin (2 pi 9.24 t - 0.45).

There are three other sinusoids mixed in, with low amplitude, frequencies between 5 and 10 Hz (so low frequency), random phases (so they don't start "in sync"), and the frequencies are not multiples of each other (so the sum never repeats).  So the sum represents Signal + noise.  But what is "t"?  Time starts at 0, and increments by 0.01 each sample (since you are sampling at 100 Hz).  You should be able to code this in LabVIEW.  In my earlier description, I had noise amplitude, frequency, and phase all "semi-randomly" chosen -- here, I just picked constants for illustration.

 

I wrote a simple VI to generate 10 seconds of such a signal.  Since I was generating it to produce the picture below, I generated all 10 seconds of Signal and Noise using the Sinusoid Waveform Generator, but it would be equally simple to generate it in a point-by-point manner using the technique I discussed in my earlier response.

 

So here is the waveform I "made up" earlier.  The White Trace is Signal, the Red is Signal + Noise.  Note that (a) the Noise is "low frequency", (b) is "non-repeating" (hence arguably "random", even though we know it is strictly deterministic), and (c) easily generated.  

Signal + Noise.png

Of course, just as I finished this and pasted the graph, I started thinking about other methods of generating low frequency noise (basically using the Low Pass Filter idea already mentioned).  I'll need to play with this a bit more ...

 

Bob Schor

 

0 Kudos
Message 5 of 6
(4,296 Views)

Thanks for the help! I will work a bit more on this solution but it is really close from the final result I'm looking for.

I will keep you update.

Thanks a lot!

0 Kudos
Message 6 of 6
(4,289 Views)