资源简介

信号检测与估计理论极小化极大准则,自己编写,欢迎下载

资源截图

代码片段和文件信息

clc
clear all
close all

    words=‘请输入数据:‘;
    prompt={‘请输入c00‘‘请输入c10‘‘请输入c01‘‘请输入c11‘‘请输入猜测先验概率P1g‘};
    answer = inputdlg(promptwords[1 50; 1 50 ;1 50;1 50;1 50]{‘1‘ ‘4‘ ‘8‘ ‘2‘ ‘0.4‘});
    c00=str2double(answer (1));
    c10=str2double(answer (2));
    c01=str2double(answer (3));
    c11=str2double(answer (4));
    p1g=str2double(answer (5));
    
%% ======求Cmin最小平均代价==========
k=1000;
N=1;A=2;
p1=zeros(k1);
p0=zeros(k1);
th=zeros(k1);
pf_p1=zeros(k1);
pm_p1=zeros(k1);
pd_p1=zeros(k1);
C_p1=zeros(k1); 
delta2=1;
d=sqrt(N*(A^2)/delta2);
for i=1:k
    p1(i1)=i/k;
    p0(i1)=1-p1(i1);
    th(i1)=(p0(i1)*(c10-c00))/(p1(i1)*(c01-c11));
    pf_p1(i1)=qfunc(log(th(i1))/d+d/2);
    pd_p1(i1)=qfunc(log(th(i1))/d-d/2);
    pm_p1(i1)=1-pd_p1(i1);
    C_p1(i1)=c00+(c10-c00)*pf_p1(i1)+p1(i1)*((c11-c00)+(c01-c11)*pm_p1(i1)-(c10-c00)*pf_p1(i1));
    
end

%% =====猜测先验概率p1g时候的C========
    p0g=1-p1g;
    thg=(p0g*(c10-c00))/(p1g*(c01-c11));
    delta2=1;
    d=sqrt(N*(A^2)/delta2);
    pf_p1g=qfunc(log(thg)/d+d/2);
    pd_p1g=qfunc(log(thg)/d-d/2);
    pm_p1g=1-pd_p1g;   
    for i=1:k
        p1(i1)=i/k;  
        C_p1_p1g(i1)=c00+(c10-c00)*pf_p1g+p1(i1)*((c11-c00)+(c01-c11)*pm_p1g-(c10-c00)*pf_p1g);
    end
%% 动态图部分
h = plot(00)
annotation(‘arrow‘[0.132 0.132][0.8 1]);
annotation(‘arrow‘[0.8 1][0.108 0.108]);
b=max(C_p1);
for mp1g=0:0.1:1
    mp0g=1-mp1g;
    mthg=(mp0g*(c10-c00))/(mp1g*(c01-c11));
    delta2=1;
    d=sqrt(N*(A^2)/delta2);
    mpf_p1g=qfunc(log(mthg)/d+d/2);
    mpd_p1g=qfunc(log(mthg)/d-d/2);
    mpm_p1g=1-mpd_p1g;   
   
    for i=1:k
        p1(i1)=i/k;  
        mC_p1_p1g(i1)=c00+(c10-c00)*mpf_p1g+p1(i1)*((c11-c00)+(c01-c11)*mpm_p1g-(c10-c00)*mpf_p1g);
    end
    
    set(h‘XData‘p1

评论

共有 条评论