how find optimal threshold?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
alex
le 21 Oct 2022
Réponse apportée : Star Strider
le 21 Oct 2022
Hi I have this code and my density functions are P(w1)=1/3 and P(w2)=2/3
x = [-5:.1:5];
plota = normpdf(x,0,1);
plotb = normpdf(x,1,0.8);
figure; hold on;
plot(x,plota,'r');
plot(x,plotb,'b');
How can I get optimal threshold like this
0 commentaires
Réponse acceptée
Star Strider
le 21 Oct 2022
I am not certain what you are asking.
The ‘threshold’ as illustrated would be the mean (or median) of the selected normal distribution.
To get ‘area1’ and ‘area2’ —
x = [-5:.01:5];
plota = normpdf(x,0,1);
plotb = normpdf(x,1,0.8);
mean_a = mean(plota);
x_b = normpdf(mean_a,1,0.8);
area_a = 1 - normcdf(mean_a,0,1)
area_b = 1 - normcdf(mean_a,1,0.8)
figure
hold on
plot(x,plota,'r')
plot(x,plotb,'b')
plot([1 1]*mean_a, [0 1]*normpdf(mean_a,0,1), '--k')
patch([x(x>=mean_a) flip(x(x>=mean_a))], [zeros(size(x(x>=mean_a))) flip(normpdf(x(x>=mean_a),0,1))],'r', 'FaceAlpha',0.5)
patch([x(x>=mean_a) flip(x(x>=mean_a))], [zeros(size(x(x>=mean_a))) flip(normpdf(x(x>=mean_a),1,0.8))],'b', 'FaceAlpha',0.5)
hold off
I am not certain where you want to go from there.
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!