王福昌
概率论中不同参数下的Beta分布概率密度函数图形绘制
2024-2-21 14:31
阅读:1192

不同参数下的Beta分布概率密度函数图形

clear,clc,close all %%%%%%%%%%%%%%%%%%%%%%% a<1,b<1 and a>1,b>1 figure('color','white');hold on %%% 画坐标轴 % M = [-0.1,0]; N = [2.5,0]; arrow2dp(M,N); % x 轴 % hold on % M = [0,-0.1]; N = [0,2.2]; arrow2dp(M,N);% x 轴 text(-0.05,-0.09,'$$O$$','InterPreter','LaTex','FontSize',14) text(-0.11,1.85,'$$f(x)$$','InterPreter','LaTex','FontSize',16) text(1.1,-0.1,'$$x$$','InterPreter','LaTex','FontSize',16) %%% 画概率密度函数 x1 = 0.01:0.01:0.99; y = betapdf(x1,0.6,0.5);plot(x1,y,'b-','LineWidth',1.5); x2 = 0.0:0.01:1;y = betapdf(x2,2,3); plot(x2,y,'r-','LineWidth',1.5) plot([1,1],[0,2.2],'k--','LineWidth',1.2) xlim([-0.1 1.2]); ylim([-0.1 2.1]) ax = gca; ax.Position = [0.1 0.1 0.9 0.9]; ax.FontName = 'times new roman'; ax.FontSize = 14; % 坐标轴移到原点 ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; % box off % 坐标轴刻度 使用LaTex公式 xticks([0.5,1]); xticklabels({'$0.5$','$1$'}); yticks([0.5,1,1.5,2]); yticklabels({'$0.5$','$1$','$1.5$','$2.0$'}); ax.TickLabelInterpreter = 'latex'; x = [0.35 0.2]; y = [0.9,0.7];  annotation('textarrow',x,y,'String','$\alpha = 0.6<1,\beta = 0.5<1$ ','Interpreter','latex','FontSize',14) x = [0.6 0.54]; y = [0.8,0.7];  annotation('textarrow',x,y,'String','$\alpha = 2>1,\beta = 3>1$ ','Interpreter','latex','FontSize',14) % 图例 使用Latex公式 % h=legend('$\bar{R}(\tau)=A\frac{\sin(\pi B\tau)}{\pi B\tau}\cos(2\pi\tilde{f}\tau)$',... %     '$\hat{S}(\tau)=\pm A\frac{\sin(\pi B\tau)}{\pi B\tau}$',... %     'Interpreter','latex','FontSize',14,... %     'Box','off'); % h.Position = h.Position + [0 -0.06 0 0.06]; % 坐标轴箭头 annotation('arrow',[0.17, 0.17],[0.1, 0.99999],'LineWidth',1.5); annotation('arrow',[0.1, 0.999],[0.142, 0.142],'LineWidth',1.5); %axis equal; %%%%%%%%%%%%%%%%%%%%%%%%% a<1,b>=1 and a>=1,b<1 figure('color','white');hold on %%% 画坐标轴 % M = [-0.1,0]; N = [2.5,0]; arrow2dp(M,N); % x 轴 % hold on % M = [0,-0.1]; N = [0,2.2]; arrow2dp(M,N);% x 轴 text(-0.05,-0.09,'$$O$$','InterPreter','LaTex','FontSize',14) text(-0.11,1.85,'$$f(x)$$','InterPreter','LaTex','FontSize',16) text(1.1,-0.1,'$$x$$','InterPreter','LaTex','FontSize',16) %%% 画概率密度函数 x1 = 0.01:0.01:0.99; y = betapdf(x1,0.8,1.2);plot(x1,y,'b-','LineWidth',1.5); x2 = 0.0:0.01:1;y = betapdf(x2,1.3,0.7); plot(x2,y,'r-','LineWidth',1.5) plot([1,1],[0,2.2],'k--','LineWidth',1.2) xlim([-0.1 1.2]); ylim([-0.1 2.1]) ax = gca; ax.Position = [0.1 0.1 0.9 0.9]; ax.FontName = 'times new roman'; ax.FontSize = 14; % 坐标轴移到原点 ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; % box off % 坐标轴刻度 使用LaTex公式 xticks([0.5,1]); xticklabels({'$0.5$','$1$'}); yticks([0.5,1,1.5,2]); yticklabels({'$0.5$','$1$','$1.5$','$2.0$'}); ax.TickLabelInterpreter = 'latex'; x = [0.34 0.25]; y = [0.9,0.71];  annotation('textarrow',x,y,'String','$\alpha = 0.8<1,\beta = 1.2>1$ ','Interpreter','latex','FontSize',14) x = [0.68 0.73]; y = [0.78,0.68];  annotation('textarrow',x,y,'String','$\alpha = 1.3>1,\beta = 0.7<1$ ','Interpreter','latex','FontSize',14) % 图例 使用Latex公式 % h=legend('$\bar{R}(\tau)=A\frac{\sin(\pi B\tau)}{\pi B\tau}\cos(2\pi\tilde{f}\tau)$',... %     '$\hat{S}(\tau)=\pm A\frac{\sin(\pi B\tau)}{\pi B\tau}$',... %     'Interpreter','latex','FontSize',14,... %     'Box','off'); % h.Position = h.Position + [0 -0.06 0 0.06]; % 坐标轴箭头 annotation('arrow',[0.17, 0.17],[0.1, 0.99999],'LineWidth',1.5); annotation('arrow',[0.1, 0.999],[0.142, 0.142],'LineWidth',1.5); %axis equal; %%%%%%%%%%%%%%%%%%%% a=1,b>=1 and a>1,b=1 figure('color','white');hold on %%% 画坐标轴 % M = [-0.1,0]; N = [2.5,0]; arrow2dp(M,N); % x 轴 % hold on % M = [0,-0.1]; N = [0,2.2]; arrow2dp(M,N);% x 轴 text(-0.05,-0.09,'$$O$$','InterPreter','LaTex','FontSize',14) text(-0.11,1.85,'$$f(x)$$','InterPreter','LaTex','FontSize',16) text(1.1,-0.1,'$$x$$','InterPreter','LaTex','FontSize',16) %%% 画概率密度函数 x1 = 0.01:0.01:0.99; y = betapdf(x1,1,1.2);plot(x1,y,'b-','LineWidth',1.5); x2 = 0.0:0.01:1;y = betapdf(x2,1.3,1); plot(x2,y,'r-','LineWidth',1.5) plot([1,1],[0,2.2],'k--','LineWidth',1.2) xlim([-0.1 1.2]); ylim([-0.1 2.1]) ax = gca; ax.Position = [0.1 0.1 0.9 0.9]; ax.FontName = 'times new roman'; ax.FontSize = 14; % 坐标轴移到原点 ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; % box off % 坐标轴刻度 使用LaTex公式 xticks([0.5,1]); xticklabels({'$0.5$','$1$'}); yticks([0.5,1,1.5,2]); yticklabels({'$0.5$','$1$','$1.5$','$2.0$'}); ax.TickLabelInterpreter = 'latex'; x = [0.34 0.25]; y = [0.8,0.62];  annotation('textarrow',x,y,'String','$\alpha = 1,\beta = 1.2>1$ ','Interpreter','latex','FontSize',14) x = [0.68 0.73]; y = [0.68,0.637];  annotation('textarrow',x,y,'String','$\alpha = 1.3>1,\beta =1$ ','Interpreter','latex','FontSize',14) % 图例 使用Latex公式 % h=legend('$\bar{R}(\tau)=A\frac{\sin(\pi B\tau)}{\pi B\tau}\cos(2\pi\tilde{f}\tau)$',... %     '$\hat{S}(\tau)=\pm A\frac{\sin(\pi B\tau)}{\pi B\tau}$',... %     'Interpreter','latex','FontSize',14,... %     'Box','off'); % h.Position = h.Position + [0 -0.06 0 0.06]; % 坐标轴箭头 annotation('arrow',[0.17, 0.17],[0.1, 0.99999],'LineWidth',1.5); annotation('arrow',[0.1, 0.999],[0.142, 0.142],'LineWidth',1.5); %%%%%%%%%%%%%%%%%% a=1,b=1 figure('color','white');hold on %%% 画坐标轴 % M = [-0.1,0]; N = [2.5,0]; arrow2dp(M,N); % x 轴 % hold on % M = [0,-0.1]; N = [0,2.2]; arrow2dp(M,N);% x 轴 text(-0.05,-0.09,'$$O$$','InterPreter','LaTex','FontSize',14) text(-0.11,1.85,'$$f(x)$$','InterPreter','LaTex','FontSize',16) text(1.1,-0.1,'$$x$$','InterPreter','LaTex','FontSize',16) %%% 画概率密度函数 x1 = 0.01:0.01:0.99; y = betapdf(x1,1,1);plot(x1,y,'b-','LineWidth',1.5); plot([1,1],[0,2.2],'k--','LineWidth',1.2) xlim([-0.1 1.2]); ylim([-0.1 2.1]) ax = gca; ax.Position = [0.1 0.1 0.9 0.9]; ax.FontName = 'times new roman'; ax.FontSize = 14; % 坐标轴移到原点 ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin'; % box off % 坐标轴刻度 使用LaTex公式 xticks([0.5,1]); xticklabels({'$0.5$','$1$'}); yticks([0.5,1,1.5,2]); yticklabels({'$0.5$','$1$','$1.5$','$2.0$'}); ax.TickLabelInterpreter = 'latex'; x = [0.5 0.6]; y = [0.7,0.57];  annotation('textarrow',x,y,'String','$\alpha = 1,\beta = 1$ ','Interpreter','latex','FontSize',14) % 坐标轴箭头 annotation('arrow',[0.17, 0.17],[0.1, 0.99999],'LineWidth',1.5) annotation('arrow',[0.1, 0.999],[0.142, 0.142],'LineWidth',1.5);

转载本文请联系原作者获取授权,同时请注明本文来自王福昌科学网博客。

链接地址:https://wap.sciencenet.cn/blog-292361-1422483.html?mobile=1

收藏

分享到:

下一篇
当前推荐数:1
推荐人:
推荐到博客首页
网友评论0 条评论
确定删除指定的回复吗?
确定删除本博文吗?