From 3e920b25b2d81d0adec8236f1088585afa847eaf Mon Sep 17 00:00:00 2001 From: giuliaghirardini <giuliaghirardini2001@gmail.com> Date: Wed, 27 Nov 2024 18:04:48 +0100 Subject: [PATCH] [main][sensitivity] Added stochastic explanation and reorganized structure --- sensitivityAnalysis/README.md | 59 +++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/sensitivityAnalysis/README.md b/sensitivityAnalysis/README.md index eb336b0e..1a1a3d20 100644 --- a/sensitivityAnalysis/README.md +++ b/sensitivityAnalysis/README.md @@ -112,9 +112,9 @@ Here's a brakedown of how it works: The `mainSensitivity.m` file defines the execution process for the simulation. A stochastic simulation involves analyzing system behavior under uncertainty by varying the parameters defined in the configuration. -### Workflow -- **Execution of Simulations**: - The key function is `sensitivityStochRun`, which generates random samples based on the parameters and uses them to run simulations. +### Stochastic function + **Execution of Simulations**: + The key function is `sensitivityStochRun`, which performs a stochastic run considering some uncertanty parameters. This function supports 4 different types of simulations according with the chosen simulation. ```matlab function [ascent, descentPara, descentBall, stability] = ... @@ -129,36 +129,41 @@ The `mainSensitivity.m` file defines the execution process for the simulation. A end ``` -### Post-Processing -Raw data is analyzed and aggregated using functions such as `postprocessAscent` and `postprocessDescent`. These steps yield useful metrics, such as: -- Maximum altitude -- Final velocity +### Stochastic simulations summary + The core of this function relies on stochastic simulation. If you're not familiar with this type of simulation and statistical concepts, here’s a brief explanation: -### Plots and Visualizations -Outputs are further processed and visualized using `plots`, providing insights into the system's behavior under varying conditions. + A **stochastic simulation** models a system where variables can change randomly, each with its own probability distribution. Essentially, it involves running repeated random experiments to estimate an outcome. The accuracy of the results improves as the number of iterations increases, so it’s important to select an appropriate number of iterations to achieve meaningful results. -### Key Parameters -- **Rocket**: Rocket configuration. -- **Wind**: Wind conditions (constant or stochastic). -- **Environment**: Environmental settings (e.g., pressure, temperature). -- **Settings**: Includes all simu + In this case, the simulations performed are **Monte Carlo simulations**, which rely on randomness to derive a deterministic solution. For instance, flight dynamics inherently involve stochasticity because they depend on unpredictable factors like wind. While wind may follow certain statistical distributions, it remains a fundamentally random atmospheric variable. + To clarify, stochastic simulation involves randomness inherent to the system itself, aiming to study or predict its behavior. In contrast, Monte Carlo simulation introduces randomness intentionally to solve a deterministic problem. Both approaches use randomness but differ in their application and purpose. -## 3. Interpreting the Outputs + #### Determining the Surface Area of a Lake + + <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Montecarlo.svg/1920px-Montecarlo.svg.png" alt="Monte Carlo Method" width="500"/> + + This is a classic example of the Monte Carlo method. Suppose we have a rectangular or square area with known side lengths. Inside this area, there is a lake with an unknown surface area. Knowing the total area of the rectangle, we can estimate the lake's area by performing a random experiment. + + We imagine firing **X** cannonballs randomly over the area. After counting how many cannonballs, **N**, land on solid ground, the number of cannonballs that fall into the lake is **X - N**. From this, we can calculate the surface area of the lake using the formula: + + $$ + \text{lake\_surface} = \text{land\_surface} \cdot \frac{X - N}{X} + $$ -The simulation generates various outputs useful for analysis. Here's how to interpret them: + **Example**: If the total land surface is **1000 m²**, **500 cannonballs** are fired, and **100 cannonballs** land in the lake, the lake's surface area is calculated as follows: -### Data Format -- **Raw Results**: - Each simulation produces a record containing parameter values and the corresponding results (e.g., achieved apogee, flight time). + $$ + \text{lake\_surface} = 1000 \cdot \frac{500 - 100}{500} = 200 \, \text{m²}. + $$ -- **Aggregated Data**: - Includes metrics such as the mean, standard deviation, and other statistical indicators. +### Output +The output of this function are `ascent, descentPara, descentBall, stability` which consists of raw data and they need to be analyzed and umpacked by the post process functions. After the post process all data are input to the plots functions. + +## 3. Interpreting the Plots +In this section an example of execution will be provided to get familiar with the type of the ouput you would get. -### Visualizations The system generates plots to represent the impact of parameter variations: -- **Sensitivity Plot**: - Shows the effect of each parameter on the final result. - -- **Distributions**: - Histograms or density curves are used to compare simulated data. +- **Sensitivity Plot**: shows the effect of each parameter on the final result. In particular, the plot you'd get is a map of the launch site in which all the elements of the simulations are shown together with 2 ellipses. The ellipses indicate the level of confidence of the simulations, which can be 65% or 90%. The more the elements fall back into the 90%-ellipse we are "more confident" that the variation of data, due to randomness, is limited. +- **Distributions**: histograms or density curves are used to compare simulated data. In more detail, you'd get histograms in which the distribution of probability of a certain altitude for apogee, for example, is depicted. + +### Example of plots \ No newline at end of file -- GitLab