Probability distribution (between zero and 1)
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have a 9216000*1 column of acceleration data, and I want to plot the acceleration vs probability (which is between 0 and 1) graph, similar to these (ignore the red area):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/989135/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/989140/image.png)
I tried several commands but none of them gave me what I wanted.
figure(1)
x1=udd(:,1);
histogram(x1,'Normalization','probability');
[N,edges]=histcounts(x1);
figure(2)
[f,xi] = ksdensity(x1);
plot(xi,f);
[p,x] = hist(x1,length(N));
figure(3)
sz = 25;
c = linspace(1,10,length(x));
scatter(x,p/sum(p),sz,c,'filled'); %PDF
figure(4)
histfit(x1,length(N),'normal');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/989145/image.png)
I want something similar to figure 2 or 4, where I can compare my data distribution with normal distribution, but not as histograms. And I want the y axis to be probability.
Thanks,
Amir
0 Commenti
Risposte (1)
Torsten
il 7 Mag 2022
Modificato: Torsten
il 7 Mag 2022
Figure 2 with the ksdensity command is exactly what you need.
The y-axis never represents probability in the plot of probability density functions - probability is the area under the curves. The "normal distribution curve" you show above (with the red area) is wrong since the area under the curve does not equal 1.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!