ENEL 649 Fall 2021 Project
We will define some helper functions here to assist us in our journey of statistical analysis.
1. Generate 100,000 samples of a uniform random variable distributed between -3 and +3. Generate a histogram of these samples, normalize to have the same area as a PDF. Plot your histogram and the theoretical PDF function together on the same figure. They should match.
Since, random variable is uniformly distributed between -3 and 3 it's PDF is equal to 1/6
2. Generate 100,000 samples of the sum of 2, 6 and 100 uniform random variables distributed between 0 and 10. Create histograms of each sum, normalize to have the same area as a PDF and plot. For each distribution, choose the number of histogram bins that produce plots that clearly show the shape of the distribution.
3. Apply a Chi-squared goodness-of-fit test for the three 100,000 sample data vectors you created in Problem 2. Your test should calculate a confidence value for each random vector. You should find that the sum of 2 and 6 uniform distributions fail the test but the sum of 100 distributions passes
4. Create a 10,000 waveform ensemble of a stochastic process where the waveform is a sinusoid with unit amplitude and random phase uniformly distributed over 0 to 2π.Your ensemble should contain 10 periods of the sinusoids and use 20 samples per period.
5. Use your 10,000 waveform ensemble from Problem 4 to numerically calculate a histogram that represents the first order PDF of this stochastic process. Normalize your histogram to have the same area as a PDF and plot your histogram on the same figure as the theoretical expression for the first order PDF for this stochastic process. They should match.
6. Use your 10,000 waveform ensemble from Problem 4 to numerically calculate the auto correlation function of the stochastic process. Plot the numerical auto correlation along with the theoretical auto correlation expression on the same figure. They should match
we will shift our ensemble by one then add all realizations of sine waves in ensemble and average them. The other one is just the average of all ensemble.
Since the correlation of function is just dependent of Tau, and Tau can vary in the range of T2 - T1, which for our ensemble can be in between -22*pi to 22*pi. Times cannot be negative, but T2 can occur before T1
Furthermore it can be shown from above data, that a cut in data at constant duration, but for different realizations yields same value. We only need to for time difefference, rather than all combinations of T1 and T2 (tau)
So, the correlation of the function from its theoretical distribution can be plotted by function of tau
From our ensemble, lets cut through all space by first keeping T1 fixed, then we will do it for T2, it would give us all values of Tau, since as shown above difference is same across all elements of returned array, we will just take its, first element and save in in you timecut variable
now we will plot our cuts in time for T2 < T1 range will be 0 to -22pi, for T1 < T2 will be 0 to 22Pi, and see if it matches with above.