how find optimal threshold?

5 次查看(过去 30 天)
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

采纳的回答

Star Strider
Star Strider 2022-10-21
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.
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by