资源描述:
《x~2分布、t分布和f分布的性质及近似计算》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、以下为三个分布的动画演示程序,直接运行:functiondandn(action)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 《X~2分布、t分布和f分布的性质及近似计算》%% 制作人:幸玮石岩顾秋容%AllRightsReserved% 2008.12%%%%%%%%%%%
2、%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%无输入参数时进行初始程序,否则调界面参数ifnargin<1,action='initialize';else%看是哪种分布data=get(gco,'UserData');pdflabel=data(4);%图形显示参数,调试时用switchpdflabelcase1xstart=0;%x轴起始点width=120;%x轴范围xdis=30;%x轴刻度间距
3、lenth=0.24;%y轴范围ydis=0.03;%y轴刻度间距speed=0.6;%动画演进速率case2width=6;xdis=3;lenth=0.42;ydis=0.05;speed=0.5;case3width=2;xdis=0.5;lenth=4;ydis=0.4;speed=0.8;endend%初始化模块ifstrcmp(action,'initialize')%数据初始化%分布函数选择pdflabel=0;d=inputdlg({'输入分布函数类型:'},'选择分布函数',1,{'x2'
4、});ifstrcmp(d,'x2')pdflabel=1;elseifstrcmp(d,'t')pdflabel=2;elseifstrcmp(d,'f')pdflabel=3;end%不符合的输入报错ifpdflabel==0errordlg('分布函数只能选择x2,t与f')returnend%整体用户界面建立,图形显示窗口嵌入figNumber=figure(...'Name','ChangingoftheX~2destributionfunction',...'NumberTitle','off'
5、,...'Visible','off');axes(...'Units','normalized',...'Visible','off',...'Position',[0.060.0650.700.9]);%显示初始现实画面switchpdflabelcase1%初始显示参数xstart=0;%x轴起始点width=120;%x轴范围xdis=30;%x轴刻度间距lenth=0.24;%y轴范围ydis=0.03;%y轴刻度间距%画背景图plot([xstartxstart+width],[lenthlen
6、th],'b');holdonplot([xstartxstart+width],[lenthlenth],'r');plot([xstartxstart+width],[lenthlenth],'black');legend('X~2分布','正态分布');axis([xstartxstart+width0lenth]);gridonset(gca,'XTick',xstart:xdis:xstart+width);set(gca,'YTick',0:ydis:lenth);holdoff%分布函数动画初
7、始参数m=0;n=1;case2width=6;xdis=3;lenth=0.42;ydis=0.05;plot([-width-widthwidth],[0lenthlenth],'b');holdonplot([-width-widthwidth],[0lenthlenth],'r--');plot([-width-widthwidth],[0lenthlenth],'black');legend('T分布','正态分布');gridonaxis([-widthwidth0lenth]);set(gca
8、,'XTick',-width:xdis:width);set(gca,'YTick',0:ydis:lenth);holdoffm=0;n=2;otherwisewidth=2;xdis=0.5;lenth=4;ydis=0.4;plot(width,0,'b');holdonplot(width,0,'r');legend('f分布','正态分布');axis([0width0lenth]);gridonse