From 7b044ffe0f6e3c811850387a721704963012c90f Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 10 Dec 2021 16:30:50 +0100 Subject: mms: add lecture --- Year_3/MMS/lecture_20211202.m | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Year_3/MMS/lecture_20211202.m (limited to 'Year_3/MMS/lecture_20211202.m') 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 -- cgit v1.2.3-18-g5258