Naming convenction of random variables in spectral representation
Samples of stochastic processes generated using spectral representation are now all labeled by the symbol :gm.
This results in the naming of the collection of generated signals (stochastic processes) as gm and the random phase angles as gm_1, gm_2, gm_3, ....
This is confusing. Since at least for spectral representation only the phase angles ϕ are the random variables, I think it would be better to name and number them as ϕ_1, ϕ_2, ϕ_3, ...
Since we need a reference to the name of the spectral representation gm_ϕ_1 would be the obvious choice.
I have a few more ideas on how we can potentially improve the PSD and SRE code:
- Don't discretize the PSD but keep it as a proper function that could be called as
PSD(ω)- This could a candidate for memoization so we can cache repeated calls for the same
ω
- This could a candidate for memoization so we can cache repeated calls for the same
- Instead of setting
ωas aVectorwe could define the cutoff frequency and number of discretization pointsNin theSpectralRepresentationand then get the vector from that whenever needed. Might be cleanier for the struct.
A question about N. You need a relatively large N for the stochastic process to be Gaussian. In one of the tests we're using 100 which is insufficient. Is there any recommendation or rule of thumb for how large N should be?
Thoughts @mbvoyager, @marcobehrendt?
Good points!
I think gm_ϕ_1 is a good choice. For me that would work.
It is also a good idea to just keep the function, I do not understand the second point regarding "memorization", I guess it's because if we keep it as a function, we need to evaluate it multiple times?
The last two points are connected.
There is a rule of thumb and this is connected to the Nyquist frequency. Following two equations must be regarded, then the guassianity of the generated signals should be ensured.
$\Delta \omega = \omega_u / N$ $\Delta t \leq 2\pi/2\omega_u$
$N$: summation terms, $\Delta \omega$: frequency increment, $\omega_u$: cut-off frequency, $\Delta t$: time increment