summaryrefslogtreecommitdiff
path: root/Year_3/MMS/normal_distribution.m
blob: 5250a84c9e612375810266a51e479c7ce75e0966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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