cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

11-Garnet

## Sinuswave with randomly variable frequency

Hi everyone,

I seem to need the help of the forum often lately...

I need for test purposes to generate a sinus-wave with randomly varying frequency (and possibly also amplitude, but that is the lesser problem).  Something like an oscillator whose frequency is not perfectly stable. Or an oscillator whose frequency setting adjustment button would be slightly turned right and left randomly by a small amount.  Something like this:

I attached my solution, but I am not happy with it at all. Obviously the "randomness" becomes higher and higher with the time, and for the same reason there are unwished jumps in the later part of the simulated signal.

I understand that the problem is the time variable "t" in the equation A*sin(2*pi*f(t)*t) .

But at the moment I can find no good simple way to correct the behaviour.

Maybe I am missing something obvious  ... I will be grateful for any hint.

Best regards

Claudio

1 ACCEPTED SOLUTION

Accepted Solutions
21-Topaz II
(To:ClaudioPedrazzi)

Hi Claudio,

in what follows, you should substitute the deterministic signal with a random one:

4 REPLIES 4
21-Topaz II
(To:ClaudioPedrazzi)

Hi Claudio,

in what follows, you should substitute the deterministic signal with a random one:

23-Emerald I
(To:ClaudioPedrazzi)

I think your problem lies in "phase jitter" for want of a better term.  You have a function that depends on time and varies frequency.  The further you are from time zero, the larger the "error" in amplitude is because sin(f*t) is changing with frequency as well as time.

Attached is a file that looks at that, then develops a vector signal based on varying the time step rather than the frequency.  You can see and play with the differences.

19-Tanzanite
(To:ClaudioPedrazzi)

The randomness should be in the phase, not the frequency. Then it will not scale with time.

Hi everyone, and a big thank you to all contributors.  I appreciate, as always, the time and effort that you put into answering.

The approach that worked best for me is the one of F.M. , but also the others are very interesting hints.  I am posting here my complete worksheet, as a contribution for future to the community.

I changed a little the naming convention and the scaling, because I wanted the "randomness" to be adimensional (so random=30% should mean the frequency can vary around +-30% of the carrier frequency, and the same for the amplitude).   also added a small function to try to "measure" the instantaneous frequency, to check if the method was working; this function is not perfect but it provides an indication.

Again, thanks a lot! this forum is a real help.

Best regards

Claudio

Announcements