How do I plot multiple Normal Distribution curves through a scatter data?

6 Ansichten (letzte 30 Tage)
Ujjwal
Ujjwal am 31 Aug. 2014
Kommentiert: Star Strider am 31 Aug. 2014
I have a set of 10 x and 10 y values for 60 different types. I have used the plot function to generate a graph with 60 curves all together.
Now I want to plot a normal distribution graph at different intervals of x.
I have uploaded a file which shows the sketch that I want to achieve. What can I do?
  2 Kommentare
dpb
dpb am 31 Aug. 2014
Bearbeitet: dpb am 31 Aug. 2014
Those are far from normal (lognormal, maybe) distributions you've sketched :), but that's a side point.
You could create additional axes without showing them for references onto which to plot the distributions but I think it would probably be just as easy to simply draw the lines in coordinate values scaled to the current axes ranges where they would belong.
ADDENDUM
I did a quick test here of the idea -- not enough to provide working code but the idea worked as desired.
>> x=0:.1:2; y=-polyval([.2 -1 1],x); % a base line
>> dy=logspace(.1,1,10)/10; % space a set nonuniformly
>> y=bsxfun(@plus,y,repmat(dy.',1,21)); % make the array
>> plot(x,y) % display
>> z=-2:0.1:2; % standardized coordinates
>> s=std(y(:,7)); % I chose x=0.6 position to play
>> m=mean(y(:,7));
>> xz=z*s+m; % values in the standardize space
>> yz=normpdf(xz,m,s); % pdf values at those z's
>> plot(0.6-(0.1*(yz-min(yz))+0.018*0.2),linspace(.3,1.5,length(yz)),'r')
The plot uses the pdf values as x coordinate and the distance normalized to the coordinates roughly manually for the y coordinates--scale based on the z values of the actual y values at the location to get it into precise coordinate space. That's just a linear transformation between the two scales.
Similarly for x I scaled the amplitude of the pdf function by 0.1 and ratio'ed by the 0.2 of the tick spacing and adjusted by the offset at z=2 that was the limit over which I computed the pdf.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by