MATLAB Answers


How to get a kernel density plot

Asked by Sana Ejaz on 3 Apr 2019
Latest activity Commented on by Sana Ejaz on 12 Apr 2019
I need to plot a kernel density for attached data but I dont know how to do it.Read some material online and watched tutorials on youtube but coudn't wrapped my head arround the plot.
Would highly appreciate if someone can help me with that.
I am attaching my data.


on 3 Apr 2019
Any pictorial example?
It is similar to the normal distribution curve.I have attached an example.
I think normall distribution curve is also one of the kinds of kernel density function but am not sure about that.
I found a script for estimating Kernal density on MATLAB file exchange:
It should be able to work on your data, so give it a try.

Sign in to comment.




1 Answer

Answer by David Wilson on 11 Apr 2019
 Accepted Answer

You also can use ksdensity from the Stats toolbox. But you have supplied us with a matrix with 25 columns! Which column were you intersted in? (Presumably you are in 1D).
load ChangeinBeta
A = ChangeInBeta;
ksdensity(A(:,1)) % just do 1st column

  1 Comment

Thank you.
That works

Sign in to comment.