fitting a custom curve in histogram
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have a histogram plot data and I want to fit some curve that is "non-traditional". Instead of the usual normal, beta, etc plots, I want to fit it with something like log(c/x) where c is a constant. Any ideas on how to achieve this?
Thanks
0 Kommentare
Antworten (1)
Star Strider
am 15 Feb. 2015
Bearbeitet: Star Strider
am 15 Feb. 2015
One possibility:
bars = randi(20, 1, 5); % Created ‘Histogram’ Data
bins = 1:5;
f = @(c,x) log(c./x);
B0 = rand;
B = nlinfit(bins, bars, f, B0);
figure(1)
bar(bins, bars)
hold on
plot(bins, f(B,bins), '-r', 'LineWidth',1.5)
hold off
You will have to experiment with it to get the result you want. I can only claim that the code I posted here runs!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!