I have a vector named speed
containining the speed of 200 walks
speed = [normrnd(80,2,100,1); normrnd(120,10,100,1)];
This vector follows a bimodal distribution.
steps
is another vector contaning the number of steps for each walk:
a = 8;
b = 100;
steps = (b-a).*rand(200,1) + a;
I create the histgram plot of the steps performed in function of the speed:
binstep = 1.5;
binranges = (min(speed):binstep:max(speed)+binstep)';
[~, ind] = histc(speed, binranges);
bincounts = accumarray(ind, steps, size(binranges));
hFig = figure(); axh = axes('Parent', hFig); hold(axh, 'all'); grid(axh, 'on');
bar(axh, binranges, bincounts); axis(axh, 'tight');
Now I would like to
- fit a bi-modal distribution to the barplot,
- estimate the parameters of the bi-modal distribution u1,u2,sigma1,sigma2,
- assess whether it is a good fit or not (i.e. the distribution is bi modal).
Could you please help me?