I am using matlab to process data to get a radius distribution function. Now I get data(an array) of different distances of other atoms to 1 specific atom. I used the "hist" command (hist(radius1,400)) and get a histogram:
But what I want is a curve, like this: http://upload.wikimedia.org/wikipedia/commons/3/31/Lennard-Jones_Radial_Distribution_Function.svg
I tried some fit command, but it would give me a normal-distribution-like curve, which is not what I want. actually no fit is fine, I only want a curve to show its varying.
The raw data was a 4000*1 array of radius, is there any other way to get a curve of the top of each bar of the histogram?
Thanks so much.
Instead of automatically plotting a histogram using hist
, you can get it to output the values:
[x, c] = hist(radius1,400);
x
is the data in each bin, c
the centre of each bin, so this replicates a histogram and then overplots a line on it (which will just connect the top of each bar so it may not look as smooth as you hoped):
bar(c,x);
hold on
plot(c,x,'r');
It is possible to use fit
with an anonymous function as a custom model, but that may be overkill in this situation.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments