From: Brian Mitchell on
I am having difficulty simultaneously plotting various pdf's with a histogram. I believe I am correctly using the hold on function and can get multiple plots. I have tried several different approaches to no avail.

The challenge appears to be scaling the functions so that the histogram and related pdf's are visible. For example, how would I scale the results from invoking ksdensity(x). I do not want to rescale the y-axis, from 0 to .08, to 0 to 35, which would only squash the plot. I want to maintain the scale so that the ksdensity(x) follows the same scale as the histogram and normal pdf.

I am fairly new to MATLAB, which is no excuse. I have spent a great deal of time reading and searching for an answer to no avail. I woulld appreciate any assistance and/or guidance.

I am aware of the histfit function, but still have problems adding another pdf to scale.

Brian D. Mitchell
From: neil on
"Brian Mitchell" <brian.d.mitchell(a)hotmail.com> wrote in message <i3aptc$65f$1(a)fred.mathworks.com>...
> I am having difficulty simultaneously plotting various pdf's with a histogram. I believe I am correctly using the hold on function and can get multiple plots. I have tried several different approaches to no avail.
>
> The challenge appears to be scaling the functions so that the histogram and related pdf's are visible. For example, how would I scale the results from invoking ksdensity(x). I do not want to rescale the y-axis, from 0 to .08, to 0 to 35, which would only squash the plot. I want to maintain the scale so that the ksdensity(x) follows the same scale as the histogram and normal pdf.
>
> I am fairly new to MATLAB, which is no excuse. I have spent a great deal of time reading and searching for an answer to no avail. I woulld appreciate any assistance and/or guidance.
>
> I am aware of the histfit function, but still have problems adding another pdf to scale.
>
> Brian D. Mitchel

Well you can either re-scale the output from the ksdensity
OR
rescale the histogram values by using
[n,xout] = hist(...)
then using a bar plot to plot the rescale histogram
bar(xout,n*scalingFactor)
From: Brian Mitchell on
"neil " <neil.iain(a)gmail.com> wrote in message <i3aqpf$rc$1(a)fred.mathworks.com>...
> "Brian Mitchell" <brian.d.mitchell(a)hotmail.com> wrote in message <i3aptc$65f$1(a)fred.mathworks.com>...
> > I am having difficulty simultaneously plotting various pdf's with a histogram. I believe I am correctly using the hold on function and can get multiple plots. I have tried several different approaches to no avail.
> >
> > The challenge appears to be scaling the functions so that the histogram and related pdf's are visible. For example, how would I scale the results from invoking ksdensity(x). I do not want to rescale the y-axis, from 0 to .08, to 0 to 35, which would only squash the plot. I want to maintain the scale so that the ksdensity(x) follows the same scale as the histogram and normal pdf.
> >
> > I am fairly new to MATLAB, which is no excuse. I have spent a great deal of time reading and searching for an answer to no avail. I woulld appreciate any assistance and/or guidance.
> >
> > I am aware of the histfit function, but still have problems adding another pdf to scale.
> >
> > Brian D. Mitchel
>
> Well you can either re-scale the output from the ksdensity
> OR
> rescale the histogram values by using
> [n,xout] = hist(...)
> then using a bar plot to plot the rescale histogram
> bar(xout,n*scalingFactor)

Thank you!
How do you rescale the output from ksdensity...again not the axis, but the output.