1);Рhold onРplot(a,pw1_plot,'co',a,pw2_plot,'r-.');Рfor k=1:mР if result(k)==0 Р plot(x(k),-0.1,'cp'); %正常细胞用五角星表示Р elseР plot(x(k),-0.1,'r*'); %异常细胞用*表示Р end;Рend;Рlegend('正常细胞后验概率曲线','异常细胞后验概率曲线','正常细胞','异常细胞');Рxlabel('样本细胞的观察值');Рylabel('后验概率');Рtitle('后验概率分布曲线');Рgrid onРreturn Р%实验内容仿真:Рx = [-3.9847, -3.5549,-1.2401,-0.9780, -0.7932, -2.8531,-2.7605, -3.7287, -3.5414 , -2.2692,-3.4549,-3.075,-3.9934,2.8792,-0.9780,0.7932,1.1882 ,3.0682,-1.5799,-1.4885,-0.7431,-0.4221,-1.1186, 4.2532 ]Рdisp(x);Рpw1=0.9;Рpw2=0.1;Р[result]=bayes(x,pw1,pw2);Р2.2最小风险贝叶斯决策(m2.m)Рx=[-3.9847 -3.5549 -1.2401 -0.9780 -0.7932 -2.8531Р -2.7605 -3.7287 -3.5414 -2.2692 -3.4549 -3.0752Р-3.9934 2.8792 -0.9780 0.7932 1.1882 3.0682Р-1.5799 -1.4885 0.7431 -0.4221 -1.1186 4.2532 ]Рpw1=0.9; pw2=0.1;Рm=numel(x); %得到待测细胞个数