diff options
Diffstat (limited to 'Year_3/MMS/normal_distribution.m')
-rw-r--r-- | Year_3/MMS/normal_distribution.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Year_3/MMS/normal_distribution.m b/Year_3/MMS/normal_distribution.m new file mode 100644 index 0000000..5250a84 --- /dev/null +++ b/Year_3/MMS/normal_distribution.m @@ -0,0 +1,14 @@ +function fn = normal_distribution(data) + mu = mean(data); + sig = var(data); + + f = @(x) (1/sig/sqrt(2*pi))*exp(-0.5*(x-mu).^2/sig^2); + xmin = min(data); + xmax = max(data); + + deltax = abs(xmax-xmin)/50; + x = xmin:deltax:xmax; + y = f(x); + + plot(x, y); +end
\ No newline at end of file |