function IdentGUI
%IDENTGUI Summary of this function goes here
% Detailed explanation goes here
close all
Position = [200 80 1000 600];
Interval = 0.02;
Panel1W = 0.48;
Panel2H = 0.5;
Position1 = [Interval 2*Interval+Panel2H Panel1W 1-3*Interval-Panel2H];
Position2 = [Interval Interval Panel1W Panel2H];
Position3 = [Interval*2+Panel1W Interval 1-3*Interval-Panel1W 1-2*Interval];
name = '辨识控制过程工具';
h.fig = figure('name', name, 'Position', Position,'color',[0.9412 0.9412 0.9412],'Units','Normalized',...
'NumberTitle', 'off', 'MenuBar','None', 'resize', 'off', 'Visible', 'on' );
chgicon(h.fig,'ECICP.png')
%% 定义panel1
h.panel1 = uipanel( 'parent', h.fig , 'Title','(一)数据处理','TitlePosition','lefttop',...
'BackgroundColor',[0.925 0.914 0.847],'Units','Normalized','Position', Position1,...
'BorderType','beveledout','BorderWidth',2,'FontName','华文楷体','FontSize',13,'FontWeight','bold');
% 按钮定义
h.ImportEdit = uicontrol('parent',h.panel1,'units','normalized','style','edit','fontsize',11,...
'Position',[0.1,0.75,0.68,0.12],'String','','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels'); %显示文件路径
imdata =imread('xp_folder_open_32.jpg');
h.Choose = uicontrol('parent',h.panel1,'units','normalized','style','pushbutton','fontsize',11,'BackgroundColor',[0.925 0.914 0.847],...
'enable','on','Position',[0.8 0.75 0.09 0.12 ],'String','','FontWeight','bold','FontName','华文楷体',...
'FontUnits','pixels','CData',imdata); %选择导入文件的文件路径按钮
h.Import = uicontrol('parent',h.panel1,'units','normalized','style','pushbutton','fontsize',11,'BackgroundColor',[0.925 0.914 0.847],...
'enable','on','Position',[0.74 0.58 0.15 0.12 ],'String','导入数据','FontWeight','bold','FontName','华文楷体',...
'FontUnits','pixels'); %导入数据按钮
h.ProcessChoose = uibuttongroup('parent',h.panel1, 'Title','选择数据处理方式','FontName','华文楷体','fontsize',11,...
'visible','on','units','normalized','Position',[0.1 0.25 0.8 0.3]);
h.u0 = uicontrol('Style','Radio','String','去除野点','units','normalized','FontName','华文楷体','fontsize',11,...
'Position',[0.1 0.3 0.3 0.4],'parent',h.ProcessChoose,'HandleVisibility','off');
h.u1 = uicontrol('Style','Radio','String','去除漂移','units','normalized','FontName','华文楷体','fontsize',11,...
'Position',[0.4 0.3 0.3 0.4],'parent',h.ProcessChoose,'HandleVisibility','off');
h.u2 = uicontrol('Style','Radio','String','滤波','units','normalized','FontName','华文楷体','fontsize',11,...
'Position',[0.7 0.3 0.3 0.4],'parent',h.ProcessChoose,'HandleVisibility','off');
h.Process = uicontrol('parent',h.panel1,'units','normalized','style','pushbutton','fontsize',11,'BackgroundColor',[0.925 0.914 0.847],...
'enable','on','Position',[0.23 0.08 0.2 0.12 ],'String','处理数据','FontWeight','bold','FontName','华文楷体',...
'FontUnits','pixels'); %处理数据按钮
h.Save = uicontrol('parent',h.panel1,'units','normalized','style','pushbutton','fontsize',11,'BackgroundColor',[0.925 0.914 0.847],...
'enable','on','Position',[0.6 0.08 0.2 0.12 ],'String','保存数据','FontWeight','bold','FontName','华文楷体',...
'FontUnits','pixels'); %保存数据按钮
%% 定义panel2
h.panel2 = uipanel( 'parent', h.fig , 'Title','(二)辨识参数配置','TitlePosition','lefttop',...
'BackgroundColor',[0.925 0.914 0.847],'Units','Normalized','Position', Position2,...
'BorderType','beveledout','BorderWidth',2,'FontName','华文楷体','FontSize',13,'FontWeight','bold');
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.06,0.83,0.3,0.1],'String','传递函数参数:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels','FontWeight','bold');
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.07,0.72,0.2,0.1],'String','分子阶数:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels');
h.NUMEdit = uicontrol('parent',h.panel2,'units','normalized','style','Edit','fontsize',12,...
'Position',[0.25,0.73,0.2,0.09],'String','2','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels'); %输入分子个数
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.07,0.62,0.2,0.1],'String','分母阶数:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels');
h.DENEdit = uicontrol('parent',h.panel2,'units','normalized','style','Edit','fontsize',12,...
'Position',[0.25,0.63,0.2,0.09],'String','3','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels');%输入分母个数
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.02,0.42,0.3,0.1],'String','模型参数:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels','FontWeight','bold');
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.07,0.3,0.2,0.1],'String','采样时间:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels');
h.TsEdit = uicontrol('parent',h.panel2,'units','normalized','style','Edit','fontsize',12,...
'Position',[0.25,0.31,0.2,0.09],'String','0.001','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels'); %输入采样时间
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.07,0.2,0.2,0.1],'String','模型输入:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels');
h.UEdit = uicontrol('parent',h.panel2,'units','normalized','style','Edit','fontsize',12,...
'Position',[0.25,0.21,0.2,0.09],'String','u','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels'); %输入模型输入
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.07,0.1,0.2,0.1],'String','模型输出:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels');
h.YEdit = uicontrol('parent',h.panel2,'units','normalized','style','Edit','fontsize',12,...
'Position',[0.25,0.11,0.2,0.09],'String','y','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels');%输入模型输出
ax = axes('parent',h.panel2,'units','normalized','position',[0.42 0.58 0.6 0.35],...
'xminortick','off','yminortick','off','xcolor',[1 1 1],'ycolor',[1 1 1],'Visible','off');%'xtick',[],'ytick',[],
axes(ax);
tmp = exist('tf.jpg','file');
if tmp == 0
errordlg('没有找到 tf.jpg 图片,无法加载!');
return;
else
if uint8(exist('imshow','file')) == 2
imshow(imread('tf.jpg'));
else
warndlg('没有安装图像处理工具箱,暂时不显示图像!');
end
end
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.5,0.43,0.27,0.1],'String','辨识结果显示:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels','FontWeight','bold');
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.46,0.33,0.2,0.1],'String','分子:','backgroundcolor',[0.925,0.914,0.847],'FontName','华文楷体',...
'FontUnits','pixels');
h.NUMReEdit = uicontrol('parent',h.panel2,'units','normalized','style','Edit','fontsize',12,...
'Position',[0.6,0.35,0.3,0.09],'String','[1 2 0 0]','backgroundcolor',[0.9412 0.9412 0.9412],'FontName','华文楷体',...
'FontUnits','pixels','enable','off'); %显示辨识出的分子
uicontrol('parent',h.panel2,'units','normalized','style','text','fontsize',13,...
'Position',[0.46,0.23,0.2,0.1],'String','分母:','backgroundcolor',[0.925,0.914,0.847],'FontName','