I have an interesting exercise that I cannot figure out. This is the exercise:
Start now with a time series of 1 Myr, a saw tooth with a wavelength of 0.1 Myr on average. The length of the wave varies randomly ±0.02 Myr (so between 80 and 120 kyrs), amplitude again 1.
So I have to create a time series of a sawtooth function, of 1000 kyrs long with timesteps of 1 kyr. The wavelength of the sawtooths have to be random, with an average of 100 kyr and varying from 80 kyr to 120 kyr. I want the time series to start at zero and end at zero, so not stop halfway during a sawtooth. Right now I am using this:
time = np.arange(0,1000,1)
func = scipy.signal.sawtooth(2 * np.pi* 0.01 * time-np.pi)
Which results in this:
I am trying to figure out how to make the wavelength irregular, but still let the time series end at zero. Does anyone have an idea?
Thanks in advance