Change histogram to curve in Matlab but not "fit"

Partita

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.

nkjt

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Overlay normal curve to histogram in R

From Java

Add density curve on the histogram

From Dev

Fit curve to a region with specific color in Matlab

From Dev

Fit curve to segmented image

From Dev

Scipy curve_fit does not seem to change the initial parameters

From Dev

Normalize 3d histogram so the sum under the curve = 1 in Matlab

From Dev

How to fit the exponential function using Matlab curve fitting tool?

From Dev

Fit a distribution to a histogram

From Dev

Fit curve to histogram ggplot

From Dev

Matlab: Fit of histogram data with many Gaussians and AIC evaluation

From Dev

Curve fit with parameter bounds

From Dev

Curve fit data issues

From Dev

Can't fit a normal curve to a grouped histogram

From Dev

JS exponential curve fit

From Dev

Fit a curve to a histogram in Python

From Dev

How to fit an exponential curve to damped harmonic oscillation data in MATLAB?

From Dev

Curve fit with a piecewise function?

From Dev

Histogram in MatLab

From Dev

How to fit a curve with a circle with matlab?

From Dev

Fit curve to segmented image

From Dev

Change code to fit strings - Matlab

From Dev

Exponential curve fit matlab

From Dev

MATLAB - Fit exponential curve WITHOUT toolbox

From Dev

how to fit a curve in the form of A = (L^x)(D^y) in Matlab?

From Dev

Change axis in histogram Matlab

From Dev

Fit a curve to the boundary of a scatterplot

From Dev

Curve fit with a piecewise function?

From Dev

Histogram fit and kernal Density plot in MATLAB

From Dev

Matlab - How to align a curve to fit its start and end points to y=0 line?