Plot of a fitted normal distribution
Show older comments
Hello!
I have following problem:
My data consists of a vector x, which contains the possible results of a property (e.g. x = particle size), and a vector y, which contains the relative frequency of x.
For example:
x = 0,1 ; 0,5 ; 1 ; 5 ; 10 ; 50 ; 100; 500
y = 7% ; 9% ; 12% ; 15% ; 30% ; 13% ; 8% ; 6%
I don´t have any absolute frequencies.
I want to plot a fitted normal distribution of this data.
Thank You!
Best regards
Leo
Accepted Answer
More Answers (1)
David Hill
on 24 Mar 2021
x=[ 0.1000 0.5000 1.0000 5.0000 10.0000 50.0000 100.0000 500.0000];
y=[0.0700 0.0900 0.1200 0.1500 0.3000 0.1300 0.0800 0.0600];
z=[];
y=floor(100*y);
x=log10(x);%looks like your data is logarithmic (if you don't take log(x), normal distribution will not be great)
for k=1:length(x)
z=[z,repmat(x(k),1,y(k))];%replicate the data based on the frequencies
end
pd=fitdist(z','Normal');
X=-3:.1:5;
Z = normpdf(X,pd.mu,pd.sigma);
plot(X,Z);
Categories
Find more on Fit Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
