how find optimal threshold?

7 visualizaciones (últimos 30 días)
alex
alex el 21 de Oct. de 2022
Respondida: Star Strider el 21 de Oct. de 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

Respuesta aceptada

Star Strider
Star Strider el 21 de Oct. de 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_a = 0.4602
area_b = 1 - normcdf(mean_a,1,0.8)
area_b = 0.8697
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.
.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by