Generate a quasiperiodic signal

Is there a way to generate a quasiperiodic signal (a signal with a certain frequency distribution, like a normal distribution)? In addition, the signal should not have a stationary frequency distribution, since the inverse Fourier transform of the Gauss function is still a Gaussian function, and what I want is an oscillating signal.

I used a discrete series of normally distributed frequencies to generate a signal, i.e.

enter image description here

Frequencies are allocated as follows:

enter image description here

So, with the initial phases

i got a signal

enter image description here

However, the signal is similar to

enter image description here

and its FFT spectrum is similar to

enter image description here.

, , t = 0 ( 4, ), 5.

, , , . , .

, ?

Python:

import numpy as np
from scipy.special import erf, erfinv
def gaussian_frequency(array_length = 10000, central_freq = 100, std = 10):
    n = np.arange(array_length)
    f = np.sqrt(2)*std*erfinv(2*n/array_length - erf(central_freq/np.sqrt(2)/std)) + central_freq
    return f
f = gaussian_frequency()
phi = np.linspace(0,2*np.pi, len(f))
t = np.linspace(0,100,100000)
signal = np.zeros(len(t))
for k in range(len(f)):
    signal += np.sin(phi[k] + 2*np.pi*f[k]*t)
def fourierPlt(signal, TIMESTEP = .001):
    num_samples = len(signal)
    k = np.arange(num_samples)
    Fs = 1/TIMESTEP
    T = num_samples/Fs
    frq = k/T # two sides frequency range
    frq = frq[range(int(num_samples/2))] # one side frequency range
    fourier = np.fft.fft(signal)/num_samples # fft computing and normalization
    fourier = abs(fourier[range(int(num_samples/2))])
    fourier = fourier/sum(fourier)
    plt.plot(frq, fourier, 'r', linewidth = 1)
    plt.title("Fast Fourier Transform")
    plt.xlabel('$f$/Hz')
    plt.ylabel('Normalized Spectrum')
    return(frq, fourier)
fourierPlt(signal)
+4
1

, , : , . , .

( f = 0) .

f 0 exp (j 2 & pi; f 0 t). .

, , .

exp (j 2 & pi; f 0 t) + exp (-j 2 & pi; f 0 t) = 2 cos (2 & pi; f 0 t).

, , .

MATLAB , , Python:

t=0:300;
s=exp(-(t-150).^2/30.^2) .* cos(2*pi*0.1*t);
subplot(2,1,1)
plot(t,s)
xlabel('time')

S=abs(fftshift(fft(s)));
f=linspace(-0.5,0.5,length(S));
subplot(2,1,2)
plot(f,S)
xlabel('frequency')

code output

, : , . , . .

+1

Source: https://habr.com/ru/post/1693143/


All Articles