summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/thucoursework/matlabscript.m
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-01 22:28:35 +0000
committerKarl Berry <karl@freefriends.org>2018-04-01 22:28:35 +0000
commita90952824018c8cc8372c913f1778fc7a7ed2e37 (patch)
treea3c582e4ce7450b449e3b39424e9d92ff395f6e6 /Master/texmf-dist/doc/latex/thucoursework/matlabscript.m
parent7d7e6b60a7a00f27ba7119097bc7484ef28fb826 (diff)
thucoursework (2apr18)
git-svn-id: svn://tug.org/texlive/trunk@47227 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/thucoursework/matlabscript.m')
-rw-r--r--Master/texmf-dist/doc/latex/thucoursework/matlabscript.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/thucoursework/matlabscript.m b/Master/texmf-dist/doc/latex/thucoursework/matlabscript.m
new file mode 100644
index 00000000000..a3b06932919
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/thucoursework/matlabscript.m
@@ -0,0 +1,14 @@
+n = 1e6; % n samples
+data = randn(1e6, 1); % Generate n Random Gaussian samples.
+nbins = 50; % bins in your histogram
+[cnt, x_hist] = hist(data, nbins); % not to plot, only to get emperical distribution.
+figure;
+cnt = cnt / n / (x_hist(2) - x_hist(1)); % normalization, be careful :)
+bar(x_hist, cnt); % plot the hist using bar()
+hold on;
+x = -5 : 0.1 : 5;
+plot(x, normpdf(x), 'r', 'linewidth', 2);
+legend({'$\hat{p}_{\sf{x}}(x)$', '$p_{\sf{x}}(x)$'}, 'Interpreter', 'LaTeX', 'fontsize', 15);
+xlabel('$x$', 'Interpreter', 'LaTeX', 'fontsize', 15); % You may change the size accordingly
+ylabel('$p_{\sf{x}}(x)$', 'Interpreter', 'LaTeX', 'fontsize', 15);
+title("\mlplaceholder{your-title-here}") \ No newline at end of file