how find optimal threshold?
조회 수: 7 (최근 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
댓글 수: 0
채택된 답변
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_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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!