Normal Distribution and area under the curve
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I am just looking to make my hw a little fancier than is needed.
The question is asking to find the % of drivers that will get a ticket, if tickets are issued 72mph and above, with a mean speed of 67.
clear;clc;
x_bar=67; %mph
x_ticket=72; %mph that will receive a ticket
s=4; %standard deviation
z1=(x_ticket-x_bar)/s;
pz=0.3944; %from table 4.3
disp('The percent of drivers exceeding 72mph is')
P=(0.5-pz)*100
rng(0,'twister')
a=4; %standard deviation
b=67; %mean value
y=a.*randn(1000,1)+b;
pd=fitdist(y,'Normal')
x=[-3:.1:3]; %+/- 15 from the mean
y=normpdf(x,0,1);
plot(x,y)
I think I am rpetty close. I just want to figure out how to get MATLAB to plot this data, and shade the ticketed region. Like the picture below.
furthermore, extra points, how can i get the area under the curve?
Thanks!
R2022a (beta)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/915009/image.png)
0 commentaires
Réponse acceptée
David Hill
le 5 Mar 2022
mu=67;
sigma=4;
x=72;
y =1 - cdf('Normal',x,mu,sigma)
2 commentaires
David Hill
le 5 Mar 2022
Likely lots of ways of doing it. I just picked the first thing that came to my mind.
mu=67;
sigma=4;
x=67-4*sigma:.1:67+4*sigma;
y =pdf('Normal',x,mu,sigma);
plot(x,y)
hold on
bar(x(x>=72),y(x>=72),'FaceColor','b','EdgeColor','b');
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!