%---------------------------------------------%
% %
% 工作室提供代做matlab仿真 %
% %
% 详情请访问:http://cn.mikecrm.com/5k6v1DP %
% %
%---------------------------------------------%
format long
gcf=figure( 'PaperSize',[20.98 29.68],'name','数值计算','NumberTitle','off') ;
% 建立名字是数值计算的图形窗口。
% 窗口句柄=figure(属性名1,属性值1,属性名2,属性值2,?)
% 界面设计
% 文本显示
uicontrol(gcf,'style','frame','back',[0.702 0.78 1.0],'position',[-1 -1 1020 687]);
uicontrol(gcf,'style','text','position',[131 374 343 32], 'string','线性方程组的数值求解', 'fontsize',18,'back','g');
% 对话框设计
%MATLAB 提供了用于建立控制对象的函数uicontrol,其调用格式为:
% 对象句柄=uicontrol(窗口句柄,属性名1,属性值1,属性名2,属性值2,?)
uicontrol(gcf,'style','frame','back','g','position',[53 263 100 105]);
%建立一个边框
uicontrol(gcf,'style','frame','back','g','position',[53 82 104 170]);
%建立一个边框
uicontrol(gcf,'style','text','position',[60 330 85 26], 'string','直接法', 'fontsize',15,'back','g');
% 文本显示
uicontrol(gcf,'style','text','position',[60 220 85 26], 'string','迭代法', 'fontsize',15,'back','g');
% 文本显示
%建立一个边框
uicontrol(gcf,'style','frame','back','g','position',[161 82 201 287]);
% 文本显示
uicontrol(gcf,'style','text','position',[215 332 80 27], 'string','输入框', 'fontsize',15,'back','g');
uicontrol(gcf,'style','text','position',[170 265 60 50], 'string','请输入方程的系数矩阵A=', 'fontsize',10,'back','g','HorizontalAlignment','left');
uicontrol(gcf,'style','text','position',[170 195 60 50], 'string','请输入方程的右端向量b=', 'fontsize',10,'back','g','HorizontalAlignment','left');
uicontrol(gcf,'style','text','position',[170 125 60 50], 'string','请输入方程的迭代初始值x0=', 'fontsize',10,'back','g','HorizontalAlignment','left');
%建立一个可输入的编辑框
hedit1= uicontrol(gcf,'style','edit','position',[235 263 115 50 ], 'string','[10,-1,0;-1 10 -2; 0 -2 10]','Max',100,'back','w','fontsize',10,'HorizontalAlignment','left');
hedit2= uicontrol(gcf,'style','edit','position',[235 197 115 50 ],'string','[9;7;6]', 'Max',100,'back','w','fontsize',10,'HorizontalAlignment','left');
hedit3= uicontrol(gcf,'style','edit','position',[235 132 115 35 ], 'string','[0;0;0]','Max',100,'back','w','fontsize',10,'HorizontalAlignment','left');
%建立一个边框
uicontrol(gcf,'style','frame','back','g','position',[369 82 171 287]);
% 文本显示
uicontrol(gcf,'style','text','position',[412 332 80 27], 'string','输出框', 'fontsize',15,'back','g');
uicontrol(gcf,'style','text','position',[375 252 45 62], 'string','这方程组的解为X=', 'fontsize',10,'back','g','HorizontalAlignment','left');
uicontrol(gcf,'style','text','position',[375 130 43 52], 'string','迭代法的迭代次数K=', 'fontsize',10,'back','g','HorizontalAlignment','left');
% 文本输出显示
htext1= uicontrol(gcf,'style','text','position',[425 210 105 104], 'fontsize',10,'back',[0.184 0.792 0.427]);
htext2= uicontrol(gcf,'style','text','position',[425 132 102 51], 'fontsize',20,'back',[0.184 0.792 0.427]);
hpush1=uicontrol(gcf,'style','push','position',[60 300 85 26], 'string','左除直接法', 'fontsize',10,'callback','COMM(hedit1,hedit2,hedit3,htext1,htext2)');
%建立一个调用直接法的按钮
hpush2=uicontrol(gcf,'style','push','position',[60 270 85 26], 'string','LU直接法', 'fontsize',10,'callback','x=COMM1(hedit1,hedit2,hedit3,htext1,htext2)');
%建立一个调用直接法的按钮
uicontrol(gcf,'style','push','position',[60 185 85 26], 'string','Jacobi跌代法', 'fontsize',10,'callback','[J,k]=COMM2(hedit1,hedit2,hedit3,htext1,htext2)');
%建立一个调用Jacobi的按钮
uicontrol(gcf,'style','push','position',[60 145 85 26], 'string','Gauss迭代法', 'fontsize',10,'callback','[GS,k]=COMM3(hedit1,hedit2,hedit3,htext1,htext2)');
%建立一个调用Gauss的按钮
uicontrol(gcf,'style','text','position',[27 0 300 50], 'string','作者:桂林理工大学 信科07-2 韦树烽','fontname','仿宋_GB2312','foregroundcolor','b', 'fontsize',12,'back',[0.702 0.78 1.0],'HorizontalAlignment','left');
uicontrol(gcf,'style','push','position',[400 15 65 26],'string','关闭窗口','fontsize',10,'callback','close') ;
%退出计算窗口
uicontrol(gcf,'style','push','position',[480 15 65 26],'string','退出系统','fontsize',10,'callback','exit') ;
%退出整个系统