~~~参考如下~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~我是分隔线~~~~~~~~~~~~~~~~~~~~
第一个m文件:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function [] = btnCall()
syms n
global edit1 edit2 edit3
p=str2double(get(edit1,'String'));
e=str2double(get(edit2,'String')); %判断是否满足条件你自己加约束,我要睡觉了,回来的有点晚~~~
value=p*(1-p)/(n*power(e,2));
LimitR=double(limit(value,n,inf));
set(edit3,'String',LimitR);
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
第二个m文件:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
global edit1 edit2 edit3
edit1=uicontrol(gcf,'style','edit','unit','normalized','position',...
[0.2,0.70,0.12,0.06],'ForegroundColor',[1 0 0],'string','','fontsize',10);
edit2=uicontrol(gcf,'style','edit','unit','normalized','position',...
[0.2,0.50,0.12,0.06],'ForegroundColor',[1 0 0],'string','','fontsize',10);
edit3=uicontrol(gcf,'style','edit','unit','normalized','position',...
[0.2,0.30,0.12,0.06],'ForegroundColor',[1 0 0],'fontsize',10);
uicontrol(gcf,'style','text','String', 'p_value','unit','normalized','position',...
[0.2,0.80,0.12,0.06],'ForegroundColor',[0 0 1],'fontsize',10,'fontname','微软雅黑');
uicontrol(gcf,'style','text','String', 'e_value','unit','normalized','position',...
[0.2,0.60,0.12,0.06],'ForegroundColor',[0 0 1],'fontsize',10,'fontname','微软雅黑');
uicontrol(gcf,'style','text','String', 'limit','unit','normalized','position',...
[0.2,0.40,0.12,0.06],'ForegroundColor',[0 0 1],'fontsize',10,'fontname','微软雅黑');
uicontrol(gcf,'style','push',...
'unit','normalized','position',[0.4,0.50,0.12,0.08],...
'BackgroundColor',0.6*[1,1,1],'ForegroundColor',[1 0 0],...
'String','计算极限','fontsize',10,'fontname','微软雅黑','callback','btnCall');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~我是分隔线~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
试运行结果:
001.png (43.58 KB, 下载次数: 6)
2015-5-9 23:52 上传