fitting a custom curve in histogram
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Star Strider
2015 年 2 月 15 日
編集済み: Star Strider
2015 年 2 月 15 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!