diff options
| author | Connor Moore <connor@hhmoore.ca> | 2026-04-26 06:31:08 -0400 |
|---|---|---|
| committer | Connor Moore <connor@hhmoore.ca> | 2026-04-26 06:31:08 -0400 |
| commit | 514c97f8b31ce6b1db9088849b20b7c1dc77bcef (patch) | |
| tree | 7fcb9144de45c331852843c4dc9256fabc9aca0c /report/figures/results/pdf_stats.m | |
| parent | ee5d0cc547564fde631e02af36a247fde45b6606 (diff) | |
Mostly finished results and lots of plots
Diffstat (limited to 'report/figures/results/pdf_stats.m')
| -rw-r--r-- | report/figures/results/pdf_stats.m | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/report/figures/results/pdf_stats.m b/report/figures/results/pdf_stats.m new file mode 100644 index 0000000..dde2b25 --- /dev/null +++ b/report/figures/results/pdf_stats.m @@ -0,0 +1,21 @@ +function [skew, kurtosis] = pdf_stats(x,p) + + % Define some useful bits + dx = x(2) - x(1); + + % The expected value (From LibreTexts 4.1) + E = @(x) sum(x .* p) * dx; + + % First moment (mean) (From LibreTexts 4.3) + mu = E(x); + + % Second moment (variance) (From LibreTexts 4.3) + sigma = sqrt(E((x - mu).^2)); + + % Third moment (skewness) (From LibreTexts 4.4) + skew = E(((x - mu)/sigma).^3); + + % Fourth moment (excess kurtosis) (From LibreTexts 4.4) + kurtosis = E(((x - mu)/sigma).^4) - 3; + +end |
