diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-12-10 16:30:50 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-12-10 16:30:50 +0100 |
commit | 7b044ffe0f6e3c811850387a721704963012c90f (patch) | |
tree | f7ce71d3f8c4c315e5826019641b288f68745ae4 /Year_3/MMS/lecture_20211202.m | |
parent | 4bcd3b16da0eb0f0efe4fb5eb1e8c6bea9e79cf2 (diff) |
mms: add lecture
Diffstat (limited to 'Year_3/MMS/lecture_20211202.m')
-rw-r--r-- | Year_3/MMS/lecture_20211202.m | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Year_3/MMS/lecture_20211202.m b/Year_3/MMS/lecture_20211202.m new file mode 100644 index 0000000..0e56243 --- /dev/null +++ b/Year_3/MMS/lecture_20211202.m @@ -0,0 +1,38 @@ +f = @(x) x.^2; +x = 0:0.1:2; +y = f(x); +integral(f, 0, 1); + +g = @(x) exp(-2 * x.^2); +integral(g, 1, inf); + +% --- + +load fish; +price70 = table2array(fish(:, 2)); +xbar = mean(price70); +s = std(price70); + +% Normal function +f = @(x) (1/s/sqrt(2*pi))*exp(-(x-xbar).^2/(s^2)/2); + +integral(f, xbar, inf); % 0.5000 + +x = (xbar- 100):1.0:(xbar+100); +y = f(x); + +% Integrated normal function +yy = normpdf(x, xbar, s); + +% Plots are the same +% plot(x, yy, 'o', x, yy, '+') + +ustemps = readtable("UStemps.txt"); +jantemps = table2array(ustemps(:, 2)); + +% normrnd(0, 1); + +tbar = mean(jantemps); +ds = std(jantemps); + +norminv(0.5, tbar, ds); % with 0.5 you have the mean
\ No newline at end of file |