Code covered by the BSD License  

Highlights from
Rsyso

image thumbnail

Rsyso

by

 

Finds realizations of SISO linear systems. Autonoma of Colombia University.

rsisotool.m
function varargout = rsisotool(varargin)
%rsisotool Tool for Realizations of SISO Systems
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @rsisotool_OpeningFcn, ...
                   'gui_OutputFcn',  @rsisotool_OutputFcn, ...
                   'gui_LayoutFcn',  @rsisotool_LayoutFcn, ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end


function h1 = rsisotool_LayoutFcn(policy)

persistent hsingleton;
if strcmpi(policy, 'reuse') & ishandle(hsingleton)
    h1 = hsingleton;
    return;
end

appdata = [];
appdata.GUIDEOptions = struct(...
    'active_h', 247.002563476563, ...
    'taginfo', struct(...
    'figure', 2, ...
    'listbox', 4, ...
    'uitable', 6, ...
    'uipanel', 6, ...
    'axes', 3, ...
    'text', 10, ...
    'pushbutton', 9, ...
    'popupmenu', 5, ...
    'edit', 2), ...
    'override', 0, ...
    'release', 13, ...
    'resize', 'none', ...
    'accessibility', 'callback', ...
    'mfile', 1, ...
    'callbacks', 1, ...
    'singleton', 1, ...
    'syscolorfig', 1, ...
    'blocking', 0);
appdata.lastValidTag = 'figure1';
appdata.GUIDELayoutEditor = [];

ssize=get(0,'ScreenSize');
if isequal(ssize(3),1280)&&isequal(ssize(4),800)
    pos=[365 318 520 280];
elseif isequal(ssize(3),1280)&&isequal(ssize(4),768)
     pos=[35 10 116 23];
elseif isequal(ssize(3),1024)&&isequal(ssize(4),768)
    pos=[237 297 550 280];
elseif isequal(ssize(3),1152)&&isequal(ssize(4),864)
    pos=[60 25 116 23];
elseif isequal(ssize(3),800)&&isequal(ssize(4),600)
    pos=[125   153   550   280];
elseif isequal(ssize(3),1280)&&isequal(ssize(4),1024)
    pos=[35 10 116 23];
else
    pos=[35 10 116 23];
end


h1 = figure(...
'Units','characters',...
'Color',[0.941176470588235 0.941176470588235 0.941176470588235],...
'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
'DockControls','off',...
'IntegerHandle','off',...
'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
'MenuBar','none',...
'Name','Rsyso',...
'NumberTitle','off',...
'PaperPosition',[0.1 2.5 8 6],...
'Position',pos,...
'Resize','off',...
'HandleVisibility','callback',...
'Tag','figure1',...
'UserData',[],...
'Visible','on',...
'CreateFcn', {@local_CreateFcn, '', appdata});

appdata = [];
appdata.lastValidTag = 'file';

h2 = uimenu(...
'Parent',h1,...
'Label','File',...
'Tag','file');

appdata = [];
appdata.lastValidTag = 'import';

h3 = uimenu(...
'Parent',h2,...
'Accelerator','A',...
'Callback','rsisotool(''import_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Import',...
'Tag','import');

appdata = [];
appdata.lastValidTag = 'export';

h4 = uimenu(...
'Parent',h2,...
'Callback','',...
'Label','Export...',...
'Tag','export');

appdata = [];
appdata.lastValidTag = 'sstow';

h72 = uimenu(...
'Parent',h4,...
'Callback','rsisotool(''sstow_Callback'',gcbo,[],guidata(gcbo))',...
'Label','SS to WorkSpace',...
'Tag','sstow');

appdata = [];
appdata.lastValidTag = 'mtftow';

h73 = uimenu(...
'Parent',h4,...
'Callback','rsisotool(''mtftow_Callback'',gcbo,[],guidata(gcbo))',...
'Label','TF to WorkSpace',...
'Tag','mtftow');

appdata = [];
appdata.lastValidTag = 'expom';

h74 = uimenu(...
'Parent',h4,...
'Callback','rsisotool(''export_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Archive .mat',...
'Separator','on',...
'Tag','expom');


appdata = [];
appdata.lastValidTag = 'ssesion';

h5 = uimenu(...
'Parent',h2,...
'Callback','rsisotool(''ssesion_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Save sesion...',...
'Separator','on',...
'Tag','ssesion');

appdata = [];
appdata.lastValidTag = 'lsesion';

h6 = uimenu(...
'Parent',h2,...
'Callback','rsisotool(''lsesion_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Load session',...
'Tag','lsesion');

appdata = [];
appdata.lastValidTag = 'print';

h7 = uimenu(...
'Parent',h2,...
'Accelerator','P',...
'Callback','rsisotool(''print_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Print',...
'Separator','on',...
'Tag','print');

appdata = [];
appdata.lastValidTag = 'pfigure';

h8 = uimenu(...
'Parent',h2,...
'Callback','rsisotool(''pfigure_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Print Figure',...
'Tag','pfigure',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'clos';

h9 = uimenu(...
'Parent',h2,...
'Accelerator','X',...
'Callback','rsisotool(''clos_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Close',...
'Separator','on',...
'Tag','clos');

appdata = [];
appdata.lastValidTag = 'analizar';

h10 = uimenu(...
'Parent',h1,...
'Label','Analysis',...
'Tag','analizar');

appdata = [];
appdata.lastValidTag = 'statespace';

h11 = uimenu(...
'Parent',h10,...
'Label','State Space',...
'Tag','statespace');

appdata = [];
appdata.lastValidTag = 'stepcommss';

h12 = uimenu(...
'Parent',h11,...
'Callback','rsisotool(''stepcommss_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Step to Response Command',...
'Tag','stepcommss');

appdata = [];
appdata.lastValidTag = 'iscon';

h13 = uimenu(...
'Parent',h11,...
'Callback','rsisotool(''iscon_Callback'',gcbo,[],guidata(gcbo))',...
'Label','is Controlable',...
'Separator','on',...
'Tag','iscon');

appdata = [];
appdata.lastValidTag = 'isobser';

h14 = uimenu(...
'Parent',h11,...
'Callback','rsisotool(''isobser_Callback'',gcbo,[],guidata(gcbo))',...
'Label','is Observable',...
'Tag','isobser');

appdata = [];
appdata.lastValidTag = 'modes';

h15 = uimenu(...
'Parent',h11,...
'Callback','rsisotool(''modes_Callback'',gcbo,[],guidata(gcbo))',...
'Label','eigenvalues',...
'Tag','modes');

appdata = [];
appdata.lastValidTag = 'transferf';

h16 = uimenu(...
'Parent',h10,...
'Label','Transfer Function',...
'Separator','on',...
'Tag','transferf');

appdata = [];
appdata.lastValidTag = 'stepcomtf';

h17 = uimenu(...
'Parent',h16,...
'Callback','rsisotool(''stepcomtf_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Step to Response Command',...
'Tag','stepcomtf');

appdata = [];
appdata.lastValidTag = 'spg';

h18 = uimenu(...
'Parent',h16,...
'Callback','rsisotool(''spg_Callback'',gcbo,[],guidata(gcbo))',...
'Label','s-plane grid',...
'Separator','on',...
'Tag','spg');

appdata = [];
appdata.lastValidTag = 'pzg';

h19 = uimenu(...
'Parent',h16,...
'Callback','rsisotool(''pzg_Callback'',gcbo,[],guidata(gcbo))',...
'Label','pzmap-grid',...
'Separator','on',...
'Tag','pzg');

appdata = [];
appdata.lastValidTag = 'nt';

h20 = uimenu(...
'Parent',h16,...
'Callback','rsisotool(''nt_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Damping',...
'Separator','on',...
'Tag','nt');

appdata = [];
appdata.lastValidTag = 'dp';

h21 = uimenu(...
'Parent',h16,...
'Callback','rsisotool(''dp_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Info',...
'Tag','dp');

appdata = [];
appdata.lastValidTag = 'helps';

h22 = uimenu(...
'Parent',h1,...
'Label','Help',...
'Tag','helps');

appdata = [];
appdata.lastValidTag = 'mhelp';

h23 = uimenu(...
'Parent',h22,...
'Callback','rsisotool(''mhelp_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Matlab Help',...
'Tag','mhelp');

appdata = [];
appdata.lastValidTag = 'exampls';

h24 = uimenu(...
'Parent',h22,...
'Callback','rsisotool(''exampls_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Examples',...
'Tag','exampls');

appdata = [];
appdata.lastValidTag = 'reffun';

h25 = uimenu(...
'Parent',h22,...
'Callback','rsisotool(''reffun_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Reference Functions',...
'Separator','on',...
'Tag','reffun');

appdata = [];
appdata.lastValidTag = 'aboutsiso';

h26 = uimenu(...
'Parent',h22,...
'Callback','rsisotool(''aboutsiso_Callback'',gcbo,[],guidata(gcbo))',...
'Label','About Rsyso...',...
'Separator','on',...
'Tag','aboutsiso');

appdata = [];
appdata.lastValidTag = 'uipanel1';

h27 = uipanel(...
'Parent',h1,...
'Units','characters',...
'FontSize',12,...
'Title','SS',...
'TitlePosition','righttop',...
'BackgroundColor',[240 240 240]/255,...
'Tag','uipanel1',...
'Clipping','on',...
'Position',[1 7.3 88.1428571428571 15.05]);

appdata = [];
appdata.lastValidTag = 'bsa';

h28 = uicontrol(...
'Parent',h27,...
'Units','characters',...
'Callback','rsisotool(''bsa_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[0 13.4 5 1.5],...
'String','A',...
'Tag','bsa',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'bsb';

h29 = uicontrol(...
'Parent',h27,...
'Units','characters',...
'Callback','rsisotool(''bsb_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[4.71428571428571 13.4 5 1.5],...
'String','B',...
'Tag','bsb',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'bsc';

h30 = uicontrol(...
'Parent',h27,...
'Units','characters',...
'Callback','rsisotool(''bsc_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[9.42857142857142 13.4 5 1.5],...
'String','C',...
'Tag','bsc',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'bsd';

h31 = uicontrol(...
'Parent',h27,...
'Units','characters',...
'Callback','rsisotool(''bsd_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[14.1428571428571 13.4 5 1.5],...
'String','D',...
'Tag','bsd',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'bsp';

h32 = uicontrol(...
'Parent',h27,...
'Units','characters',...
'Callback','rsisotool(''bsp_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[18.8571428571428 13.4 5 1.5],...
'String','P',...
'TooltipString','Matrix Transformation',...
'Tag','bsp',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'tsim';

h33 = uicontrol(...
'Parent',h27,...
'Units','characters',...
'BackgroundColor',[1 1 1],...
'Callback','rsisotool(''tsim_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[25.4285714285714 13.9 10.8571428571429 0.9],...
'String',{  'Ctrb 1.'; 'Ctrb 2.'; 'Ctrb 3.'; 'Ctrb 4.'; 'Obvs 1.'; 'Obvs 2.'; 'Obvs 3.'; 'Obvs 4.' },...
'Style','popupmenu',...
'Value',1,...
'Tag','tsim',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'uipanel2';

h34 = uipanel(...
'Parent',h1,...
'Units','characters',...
'ForegroundColor',[1 0 0],...
'HighlightColor',[1 0 0],...
'Title','',...
'Tag','uipanel2',...
'Clipping','on',...
'BackgroundColor',[0.0784313725490196 0.168627450980392 0.549019607843137],...
'Position',[91 1 22.8571428571428 21],...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text1';

h35 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[0.0784313725490196 0.168627450980392 0.549019607843137],...
'FontSize',14,...
'ForegroundColor',[1 1 1],...
'Position',[1.42857142857143 18.55 19.2857142857143 1.8],...
'String','Realizations',...
'Style','text',...
'Tag','text1',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'uipanel5';

h36 = uipanel(...
'Parent',h34,...
'Units','characters',...
'Title','',...
'Tag','uipanel5',...
'Clipping','on',...
'BackgroundColor',[0.0784313725490196 0.168627450980392 0.549019607843137],...
'Position',[2 0.6 19 5.4],...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'tryagain';

h37 = uicontrol(...
'Parent',h36,...
'Units','characters',...
'Callback','rsisotool(''tryagain_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[1.71428571428571 2.65 15.7142857142857 2.25],...
'String','Try Again',...
'TooltipString','Load the Original Model',...
'Tag','tryagain',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'cancelar';

h38 = uicontrol(...
'Parent',h36,...
'Units','characters',...
'Callback','rsisotool(''cancelar_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[1.71428571428571 0.2 15.7142857142857 2.25],...
'String','Cancel',...
'Tag','cancelar',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text7';

h39 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[0.0784313725490196 0.168627450980392 0.549019607843137],...
'FontSize',10,...
'ForegroundColor',[1 1 1],...
'Position',[0.285714285714286 17.1 17 1.25],...
'String','No Minimal :',...
'Style','text',...
'Tag','text7',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text8';

h40 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[0.0784313725490196 0.168627450980392 0.549019607843137],...
'FontSize',10,...
'ForegroundColor',[1 1 1],...
'Position',[0.285714285714286 13.15 13 1.25],...
'String','Minimal :',...
'Style','text',...
'Tag','text8',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'realnomin';

h41 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[1 1 1],...
'Callback','rsisotool(''realnomin_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[1.71428571428571 15.9 19.2857142857143 1.3],...
'String',{'1.Observable'; '2.Observable'; '3.Observable'; '4.Observable'; '5.Controlable'; '6.Controlable'; '7.Controlable'; '8.Controlable'; 'Diagonal'; 'Serie'; 'Parallel'; 'Parallel obsv'; 'Parallel ctrb' },...
'Style','popupmenu',...
'Value',1,...
'Tag','realnomin',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'realmin';

h42 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[1 1 1],...
'Callback','rsisotool(''realmin_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[1.71428571428571 11.95 19.2857142857143 1.3],...
'String',{  'Jordan'; 'Ho';'Minreal' },...
'Style','popupmenu',...
'Value',1,...
'Tag','realmin',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text9';

h43 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[0.0784313725490196 0.168627450980392 0.549019607843137],...
'FontSize',10,...
'ForegroundColor',[1 1 1],...
'Position',[0.285714285714286 9.05 18.7142857142857 1.25],...
'String','Characteristics :',...
'Style','text',...
'Tag','text9',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'charac';

h44 = uicontrol(...
'Parent',h34,...
'Units','characters',...
'BackgroundColor',[1 1 1],...
'Callback','rsisotool(''charac_Callback'',gcbo,[],guidata(gcbo))',...
'Position',[1.42857142857143 7.8 19.2857142857143 1.3],...
'String',{  'Order'; 'Poles'; 'Zeros'; 'Is Proper'; 'Is Stable'; 'DC Gain'; 'Ch. Polynomial' },...
'Style','popupmenu',...
'Value',1,...
'Tag','charac',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'mtf';

h45 = uipanel(...
'Parent',h1,...
'Units','characters',...
'BorderType','etchedout',...
'BackgroundColor',[240 240 240]/255,...
'FontSize',12,...
'Title','TF',...
'Tag','mtf',...
'Clipping','on',...
'Position',[1.57142857142857 0.9 34.1428571428571 5.8],...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text4';

h46 = uicontrol(...
'Parent',h45,...
'Units','characters',...
'FontSize',12,...
'Position',[1.42857142857143 2.9 31.1428571428571 1.5],...
'String','num',...
'Style','text',...
'Tag','text4',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text5';

h47 = uicontrol(...
'Parent',h45,...
'Units','characters',...
'FontSize',12,...
'Position',[0.571428571428571 0.25 32.8571428571429 1.6],...
'String','den',...
'Style','text',...
'Tag','text5',...
'CreateFcn', {@local_CreateFcn, ' ', appdata} );

appdata = [];
appdata.lastValidTag = 'text6';

h48 = uicontrol(...
'Parent',h45,...
'Units','characters',...
'Position',[1.28571428571429 1.75 31.2857142857143 1.35],...
'String','-----------------------------------------------',...
'Style','text',...
'Tag','text6',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'editpq';

h49 = uicontrol(...
'Parent',h1,...
'Units','characters',...
'BackgroundColor',[1 1 1],...
'Enable','inactive',...
'FontSize',12,...
'HorizontalAlignment','right',...
'Position',[54.4285714285714 0.95 35 5.6],...
'String','',...
'Style','listbox',...
'Value',1,...
'Clipping','off',...
'Tag','editpq',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'axes1';

h50 = axes(...
'Parent',h1,...
'Units','characters',...
'Position',[38 1.7 15.4285714285714 5.65],...
'CameraPosition',[0.5 0.5 9.16025403784439],...
'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
'Color',get(0,'defaultaxesColor'),...
'ColorOrder',get(0,'defaultaxesColorOrder'),...
'LooseInset',[13.8914285714286 3.1515 10.1514285714286 2.14875],...
'XColor',get(0,'defaultaxesXColor'),...
'YColor',get(0,'defaultaxesYColor'),...
'ZColor',get(0,'defaultaxesZColor'),...
'Tag','axes1',...
'UserData',[],...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h51 = get(h50,'title');

set(h51,...
'Parent',h50,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','center',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[0.49537037037037 1.06637168141593 1.00005459937205],...
'Rotation',0,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','bottom',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','on',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h52 = get(h50,'xlabel');

set(h52,...
'Parent',h50,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','center',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[0.49537037037037 -0.243362831858407 1.00005459937205],...
'Rotation',0,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','cap',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','on',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h53 = get(h50,'ylabel');

set(h53,...
'Parent',h50,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','center',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[-0.319444444444444 0.491150442477876 1.00005459937205],...
'Rotation',90,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','bottom',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','on',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h54 = get(h50,'zlabel');

set(h54,...
'Parent',h50,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','right',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[-2.46759259259259 3.65044247787611 1.00005459937205],...
'Rotation',0,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','middle',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','off',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.lastValidTag = 'axes2';

h55 = axes(...
'Parent',h1,...
'Units','characters',...
'Position',[37.7142857142857 0.25 15.8571428571429 2.55],...
'CameraPosition',[0.5 0.5 9.16025403784439],...
'CameraPositionMode',get(0,'defaultaxesCameraPositionMode'),...
'Color',get(0,'defaultaxesColor'),...
'ColorOrder',get(0,'defaultaxesColorOrder'),...
'LooseInset',[13.8914285714286 3.1515 10.1514285714286 2.14875],...
'XColor',get(0,'defaultaxesXColor'),...
'YColor',get(0,'defaultaxesYColor'),...
'ZColor',get(0,'defaultaxesZColor'),...
'Tag','axes2',...
'Visible','off',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h56 = get(h55,'title');

set(h56,...
'Parent',h55,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','center',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[0.5 1.14705882352941 1.00005459937205],...
'Rotation',0,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','bottom',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','off',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h57 = get(h55,'xlabel');

set(h57,...
'Parent',h55,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','center',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[0.490990990990991 -0.53921568627451 1.00005459937205],...
'Rotation',0,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','cap',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','off',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h58 = get(h55,'ylabel');

set(h58,...
'Parent',h55,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','center',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[-0.310810810810811 0.480392156862745 1.00005459937205],...
'Rotation',90,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','bottom',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','off',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.SerializedAnnotationV7 = struct(...
    'LegendInformation', struct(...
    'IconDisplayStyle', 'on'));

h59 = get(h55,'zlabel');

set(h59,...
'Parent',h55,...
'Units','data',...
'FontUnits','points',...
'BackgroundColor','none',...
'Color',[0 0 0],...
'DisplayName','',...
'EdgeColor','none',...
'EraseMode','normal',...
'DVIMode','auto',...
'FontAngle','normal',...
'FontName','Helvetica',...
'FontSize',10,...
'FontWeight','normal',...
'HorizontalAlignment','right',...
'LineStyle','-',...
'LineWidth',0.5,...
'Margin',2,...
'Position',[-2.38288288288288 8.65686274509804 1.00005459937205],...
'Rotation',0,...
'String','',...
'Interpreter','tex',...
'VerticalAlignment','middle',...
'ButtonDownFcn',[],...
'CreateFcn', {@local_CreateFcn, [], appdata} ,...
'DeleteFcn',[],...
'BusyAction','queue',...
'HandleVisibility','off',...
'HelpTopicKey','',...
'HitTest','on',...
'Interruptible','on',...
'SelectionHighlight','on',...
'Serializable','on',...
'Tag','',...
'UserData',[],...
'Visible','off',...
'XLimInclude','on',...
'YLimInclude','on',...
'ZLimInclude','on',...
'CLimInclude','on',...
'ALimInclude','on',...
'IncludeRenderer','on',...
'Clipping','off');

appdata = [];
appdata.lastValidTag = 'Untitled_2';

h60 = uicontextmenu(...
'Parent',h1,...
'Tag','Untitled_2',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'ss2tfun';

h61 = uimenu(...
'Parent',h60,...
'Callback','rsisotool(''ss2tfun_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Convert Space State to TF',...
'Tag','ss2tfun',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'cxreal';

h62 = uimenu(...
'Parent',h60,...
'Callback','rsisotool(''cxreal_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Complex to Real',...
'Separator','on',...
'Tag','cxreal',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'rn';

h63 = uimenu(...
'Parent',h60,...
'Callback','rsisotool(''rn_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Round System',...
'Separator','on',...
'Tag','rn',...
'CreateFcn', {@local_CreateFcn, '', appdata} );


appdata = [];
appdata.lastValidTag = 'Untitled_3';

h64 = uicontextmenu(...
'Parent',h1,...
'Tag','Untitled_3',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'tfunc2ss';

h65 = uimenu(...
'Parent',h64,...
'Callback','rsisotool(''tfunc2ss_Callback'',gcbo,[],guidata(gcbo))',...
'Label','Convert TF to Space-State',...
'Tag','tfunc2ss',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'Untitled_4';

h66 = uicontextmenu(...
'Parent',h1,...
'Tag','Untitled_4',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'sn';

h67 = uimenu(...
'Parent',h66,...
'Callback','rsisotool(''sn_Callback'',gcbo,[],guidata(gcbo))',...
'Label','see--->',...
'Tag','sn',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'Untitled_6';

h68 = uicontextmenu(...
'Parent',h1,...
'Tag','Untitled_6',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'sd';

h69 = uimenu(...
'Parent',h68,...
'Callback','rsisotool(''sd_Callback'',gcbo,[],guidata(gcbo))',...
'Label','see--->',...
'Tag','sd',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'Untitled_7';

h70 = uicontextmenu(...
'Parent',h1,...
'Tag','Untitled_7',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

appdata = [];
appdata.lastValidTag = 'fe';

h71 = uimenu(...
'Parent',h70,...
'Label','<fept>',...
'Tag','fe',...
'CreateFcn', {@local_CreateFcn, '', appdata} );

handles = [ h27 ];
set(handles, 'uicontextmenu', h60);

handles = [ h45 ];
set(handles, 'uicontextmenu', h64);

handles = [ h46 ];
set(handles, 'uicontextmenu', h66);

handles = [ h47 ];
set(handles, 'uicontextmenu', h68);

handles = [ h1 ];
set(handles, 'uicontextmenu', h70);


hsingleton = h1;



function rsisotool_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
load logo
axes(handles.axes1), imshow(escudo)
axes(handles.axes2),
text(0.1,0.43,'Rsys','FontName','Harlow Solid Italic','FontSize',18,'color',[0 0 0])
text(0.62,0.43,'S','FontName','Harlow Solid Italic','FontSize',18,'color',[0 0 0])
text(0.64,0.35,'o','FontName','Harlow Solid Italic','FontSize',18,'color',[1 0 0])
fin=[handles.bsa handles.bsb handles.bsc handles.bsd,handles.bsp,...
    handles.realnomin handles.realmin handles.charac handles.tryagain,handles.tsim];
fin1=[handles.stepcommss handles.iscon handles.isobser handles.modes,handles.pzg...
      handles.stepcomtf,handles.ss2tfun,handles.tfunc2ss,handles.spg,handles.nt,handles.dp,...
      handles.cxreal,handles.sn,handles.sd,handles.rn];
set(fin,'enable','off')
set(fin1,'visible','off')
v=ver('MATLAB');
v=str2double(v.Version);



function varargout = rsisotool_OutputFcn(hObject, eventdata, handles) 
varargout{1} = handles.output;


% --------------------------------------------------------------------
function import_Callback(hObject, eventdata, handles)
h=sys_import;
waitfor(h)
tryagain_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function export_Callback(hObject, eventdata, handles)
button1 = questdlg('What model want to export?','Export','SS','TF','TF');
if isequal(button1,'SS')
    A=get(handles.bsa,'userdata');
    B=get(handles.bsb,'userdata');
    C=get(handles.bsc,'userdata');
    D=get(handles.bsd,'userdata');
    save export A B C D
    h = msgbox('Your model is export.mat','Export','none');
    waitfor(h)
elseif isequal(button1,'TF')
        G=get(handles.mtf,'userdata');
        save export G
        h = msgbox('Your model is export.mat','Export','none');
        waitfor(h)
end   
% --------------------------------------------------------------------
function ssesion_Callback(hObject, eventdata, handles)
[file,path] = uiputfile('*.mat','Save Models As');
if ~isequal(file,0)
    A=get(handles.bsa,'userdata');
    B=get(handles.bsb,'userdata');
    C=get(handles.bsc,'userdata');
    D=get(handles.bsd,'userdata');
    G=get(handles.mtf,'userdata');
    save(file,'A','B','C','D','G')
end
% --------------------------------------------------------------------
function lsesion_Callback(hObject, eventdata, handles)
 [filename, pathname] = uigetfile( ...
        {'*.mat','Mat - Files(*.mat)';},...
        'Select System');
try
    s=[pathname filename];
    load(s,'A','B','C','D','G')
    ponerm(handles,A,B,C,D,G,1) 
catch
    errordlg('Load System Error','!! Error !!')
end
% --------------------------------------------------------------------
function print_Callback(hObject, eventdata, handles)
printdlg(handles.figure1)
% --------------------------------------------------------------------
function pfigure_Callback(hObject, eventdata, handles)
print(gcbf)
% --------------------------------------------------------------------
function clos_Callback(hObject, eventdata, handles)
close(gcbf)
% --------------------------------------------------------------------

% --------------------------------------------------------------------
function mhelp_Callback(hObject, eventdata, handles)
web(['file:///' which('report.html')])

% --------------------------------------------------------------------
function exampls_Callback(hObject, eventdata, handles)
button = questdlg('What models do you want to see?','Examples','SS','TF','SS');
if isequal(button,'SS')
  web(['file:///' which('exampless.html')])
elseif isequal(button,'TF')
   web(['file:///' which('examplestf.html')])
end   
% --------------------------------------------------------------------
function reffun_Callback(hObject, eventdata, handles)
try
    winopen('Rsyso.pdf')
catch
    disp('Try open by archive Rsyso.pdf')
end
% --------------------------------------------------------------------
function aboutsiso_Callback(hObject, eventdata, handles)
creditos
% --------------------------------------------------------------------

function stepcomtf_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
figure,step(G)
% --------------------------------------------------------------------

function stepcommss_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
if isreal(A)
    B=get(handles.bsb,'userdata');
    C=get(handles.bsc,'userdata');
    D=get(handles.bsd,'userdata');
    figure,step(A,B,C,D)
else
    errordlg('Model is Complex, use conversin to Real','!!--Error--!!')
end
% --------------------------------------------------------------------
function iscon_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
B=get(handles.bsb,'userdata');
co=ctrb(A,B);
if rank(co)>=rank(A)
    set(handles.editpq,'string','is Controlable')
else
     set(handles.editpq,'string','is not Controlable')
end
% --------------------------------------------------------------------
function isobser_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
C=get(handles.bsc,'userdata');
co=obsv(A,C);
if rank(co)>=rank(A)
    set(handles.editpq,'string','is Observable')
else
     set(handles.editpq,'string','is not Observable')
end

% --------------------------------------------------------------------
function modes_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
ei=eig(A);
ei=round(ei*10000)/10000;
set(handles.editpq,'string',num2str(ei))
% --- Executes on button press in tryagain.
function tryagain_Callback(hObject, eventdata, handles)
a=exist('system.mat','file');
if a==2
    s=load('system.mat');
    name=fieldnames(s);
    if ismember({'op','n'},name)
        try
            h = waitbar(0,'rsyso GUI is Loading. Please wait...'); 
            if  s.op==1
                A=s.A;B=s.B;C=s.C;D=s.D;
                [num den]=ss2tf(A,B,C,D);
                G=tf(num,den);
                waitbar(1/4)                            
            elseif s.op==2
                G=s.sys;
                [A B C D]=dssdata(G);
                waitbar(1/4)                        
            end
             waitbar(3/4)
             close(h)
             ponerm(handles,A,B,C,D,G,s.op)            
        catch
            %close(h)
            errordlg('System not Found','!! Error !!')            
        end        
    end   
end
function cancelar_Callback(hObject, eventdata, handles)
close(gcbf)

% --- Executes on selection change in realnomin.
function realnomin_Callback(hObject, eventdata, handles)
val=get(hObject,'value');
G=get(handles.mtf,'userdata');
set(handles.bsp,'enable','off')
if val>=1&&val<=8
    [A,B,C,D] = tf2rform(G,val);
else
    switch val
        case 9  %diagonal          
            [csys] = canon(G,'modal');
            A=csys.a;B=csys.b;C=csys.c;D=csys.d;
        case 10%serie
             if isreal(pole(G))
                 [A,B,C,D] = seriesform(G);
             else
                 [A,B,C,D] = ssdata(G);
             end
        case 11%parallel
            [A B C D]=parallelform(G); 
        case 12 
            [A B C D]=parallelform(G,0);
        case 13
            [A B C D]=parallelform(G,1);
    end
end
set(handles.bsa,'userdata',A)
set(handles.bsb,'userdata',B)
set(handles.bsc,'userdata',C)
set(handles.bsd,'userdata',D)
hObject=handles.bsa;
bsa_Callback(hObject,eventdata,handles)
% --- Executes on selection change in realmin.
function realmin_Callback(hObject, eventdata, handles)
val=get(hObject,'value');
G=get(handles.mtf,'userdata');
set(handles.bsp,'enable','off')
[a1 b1 c1 D]=dssdata(G);
if val==1
    [V, A] = jordan(a1);
    B=inv(V)*b1;
    C=c1*V;
elseif val==2
    [A B C D]=minhoform(G);
elseif val==3    
    sys=ss(a1,b1,c1,D);
    if isreal(sys)
        csys=minreal(sys);
        A=csys.a;B=csys.b;C=csys.c;
    else
        warndlg('Try to transform the complex to real system','!! Warning !!');
        A=get(handles.bsa,'userdata');
        B=get(handles.bsb,'userdata');
        C=get(handles.bsc,'userdata');
        D=get(handles.bsd,'userdata');
    end
end
set(handles.bsa,'userdata',A)
set(handles.bsb,'userdata',B)
set(handles.bsc,'userdata',C)
set(handles.bsd,'userdata',D)
hObject=handles.bsa;
bsa_Callback(hObject,eventdata,handles)
% --- Executes on selection change in charac.
function charac_Callback(hObject, eventdata, handles)
var=get(hObject,'value');
set(handles.bsp,'enable','off')
G=get(handles.mtf,'userdata');
switch var
    case 1
        if isreal(G)
            p=mindeg(G);       
        else
            p=length(pole(G));
        end
    case 2
       p=pole(G);
       p=round(p*1000)/1000;
       p=num2str(p);         
    case 3        
       p=zero(G);
       p=num2str(p,4);       
    case 4
       if isproper(G)
          p=sprintf('is proper');
       else
          p=sprintf('is not proper');
       end
    case 5
       if isstable(G)
          p=sprintf('is stable');
       else
          p=sprintf('is not stable');
       end 
    case 6 
       p=dcgain(G);
    case 7
        [num,den]=tfdata(G);
        den=cell2mat(den);
        p=char(factor(poly2sym(round(den*100)/100,'s')));
       
end
 set(handles.editpq,'string',p)
% --------------------------------------------------------------------
function tfunc2ss_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
[A,B,C,D] = dssdata(G);
set(handles.bsa,'userdata',A)
set(handles.bsb,'userdata',B)
set(handles.bsc,'userdata',C)
set(handles.bsd,'userdata',D)
hObject=handles.bsa;
bsa_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function ss2tfun_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
B=get(handles.bsb,'userdata');
C=get(handles.bsc,'userdata');
D=get(handles.bsd,'userdata');
[num den]=ss2tf(A,B,C,D);
G=minreal(tf(num,den));
set(handles.mtf,'userdata',G)
ftstring(handles)

function ftstring(handles)
G=get(handles.mtf,'userdata');
[num den]=tfdata(G);
num=cell2mat(num);
den=cell2mat(den);
i=1;
if length(num)~=1
    while num(i)==0
        num(i)=[];
    end
end
if length(num)~=1
    num=char(factor(poly2sym(num,'s')));    
end
den=factor(poly2sym(round(den*100)/100,'s'));
set(handles.text4,'string',num)
set(handles.text5,'string',char(den))
p=pole(G);
p=round(p*1000)/1000;
p=num2str(p);       
set(handles.editpq,'string',p)

function bsa_Callback(hObject, eventdata, handles)
x.data=get(hObject,'userdata');
if ~isreal(x.data)
    x.data=noreal(x.data);
end
x.rowheader= {'A'};
x.clab='x';x.rlab='x';
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)



function bsb_Callback(hObject, eventdata, handles)
x.data=get(hObject,'userdata');
if ~isreal(x.data)
    x.data=noreal(x.data);
end
x.rowheader= {'B'};
x.clab='u';x.rlab='x';
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)



function bsc_Callback(hObject, eventdata, handles)
x.data=get(hObject,'userdata');
if ~isreal(x.data)
    x.data=noreal(x.data);
end
x.rowheader= {'C'};
x.clab='x';x.rlab='y';
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)

function bsd_Callback(hObject, eventdata, handles)
x.data=get(hObject,'userdata');
x.rowheader= {'D'};
x.clab='u';x.rlab='y';
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)

function bsp_Callback(hObject, eventdata, handles)
x.data=get(hObject,'userdata');
x.rowheader= {'T'};
x.clab='x';x.rlab='x';
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)

function ponerm(handles,A,B,C,D,G,op)
set(handles.mtf,'userdata',G)
set(handles.bsa,'userdata',A)
set(handles.bsb,'userdata',B)
set(handles.bsc,'userdata',C)
set(handles.bsd,'userdata',D)
set(handles.tryagain,'userdata',op)

fin=[handles.bsa handles.bsb handles.bsc handles.bsd,...
    handles.realnomin handles.realmin handles.charac handles.tryagain,handles.tsim];
fin1=[handles.stepcommss handles.iscon handles.isobser handles.modes,handles.pzg...
      handles.stepcomtf,handles.ss2tfun,handles.tfunc2ss,handles.spg,handles.nt,handles.dp,...
      handles.cxreal,handles.sn,handles.sd,handles.rn];
set(fin,'enable','on')
set(fin1,'visible','on')
%x.top= 390;
%x.left =25;
x.rowheader= {'A'};
x.clab='x';
x.rlab='x';
if ~isreal(A)
    A=noreal(A);
end
x.data=A;
datagrid(x,handles.uipanel1)
ftstring(handles)


% --------------------------------------------------------------------
function nt_Callback(hObject, eventdata, handles)
G=get(handles.bsa,'userdata');
[Wn,Z,P] = damp(G);
k=[P Wn Z];
x.data=k;
if ~isreal(x.data)
    x.data=noreal(x.data);
end
x.rowheader= {'I'};
x.rlab='p';
x.collabels={'pole';'Wn';'z'};
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)

function M=noreal(M)
[fm cm]=size(M);
a=M;
M=[];
for i=1:fm
    for j=1:cm
        M{i,j}=num2str(a(i,j));
    end
end
return

% --------------------------------------------------------------------
function dp_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
s = stepinfo(G);
x.data=[s.RiseTime s.SettlingTime s.PeakTime];
x.rowheader= {'t'};
x.rlab='x';
x.collabels={'tr';'tp';'tss'};
%x.top= 390;
%x.left =25;
datagrid(x,handles.uipanel1)


% --------------------------------------------------------------------
function spg_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
figure,
rlocus(G)
sgrid


% --------------------------------------------------------------------
function pzg_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
figure
pzmap(G)
grid on


% --------------------------------------------------------------------
function sd_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
[num den]=tfdata(G);
den=cell2mat(den);
p=char(factor(poly2sym(round(den*100)/100,'s')));
set(handles.editpq,'string',p)

% --------------------------------------------------------------------
function sn_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
den=tfdata(G);
num=tfdata(G);
den=cell2mat(num);
p=char(factor(poly2sym(round(den*100)/100,'s')));
set(handles.editpq,'string',p)


function tsim_Callback(hObject, eventdata, handles)
val=get(hObject,'value');
A=get(handles.bsa,'userdata');
B=get(handles.bsb,'userdata');
C=get(handles.bsc,'userdata');
D=get(handles.bsd,'userdata');
[An Bn Cn P]=ss2rform(A,B,C,val);
set(handles.bsp,'enable','on')
set(handles.bsp,'userdata',P)
set(handles.bsa,'userdata',An)
set(handles.bsb,'userdata',Bn)
set(handles.bsc,'userdata',Cn)
set(handles.bsd,'userdata',D)
hObject=handles.bsa;
bsa_Callback(hObject, eventdata, handles)


% --------------------------------------------------------------------
function cxreal_Callback(hObject, eventdata, handles)
qstring = 'Are you sure the model is in Jordan Form?';
c= questdlg(qstring,'Complex to Real Jordan Form','Yes','No','No');
if strcmp('Yes', c)
    A=get(handles.bsa,'userdata');
    B=get(handles.bsb,'userdata');
    C=get(handles.bsc,'userdata');
    [An Bn Cn P]=cx2rJ(A,B,C);
    set(handles.bsp,'enable','on')
    set(handles.bsp,'userdata',P)
    set(handles.bsa,'userdata',An)
    set(handles.bsb,'userdata',Bn)
    set(handles.bsc,'userdata',Cn)
    hObject=handles.bsa;
    bsa_Callback(hObject, eventdata, handles)
end

function rn_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
B=get(handles.bsb,'userdata');
C=get(handles.bsc,'userdata');
D=get(handles.bsd,'userdata');
set(handles.bsd,'userdata',roundSys(D))
set(handles.bsa,'userdata',roundSys(A))
set(handles.bsb,'userdata',roundSys(B))
set(handles.bsc,'userdata',roundSys(C))
hObject=handles.bsa;
bsa_Callback(hObject, eventdata, handles)

function [A]=roundSys(A)
A=round(A*100)/100;

function sstow_Callback(hObject, eventdata, handles)
A=get(handles.bsa,'userdata');
B=get(handles.bsb,'userdata');
C=get(handles.bsc,'userdata');
D=get(handles.bsd,'userdata');
assignin('base','A',A);
assignin('base','B',B);
assignin('base','C',C);
assignin('base','D',D);

function mtftow_Callback(hObject, eventdata, handles)
G=get(handles.mtf,'userdata');
assignin('base','G',G);

function local_CreateFcn(hObject, eventdata, createfcn, appdata)

if ~isempty(appdata)
   names = fieldnames(appdata);
   for i=1:length(names)
       name = char(names(i));
       setappdata(hObject, name, getfield(appdata,name));
   end
end

if ~isempty(createfcn)
      eval(createfcn); 
end


function varargout = gui_mainfcn(gui_State, varargin)
gui_StateFields =  {'gui_Name'
                    'gui_Singleton'
                    'gui_OpeningFcn'
                    'gui_OutputFcn'
                    'gui_LayoutFcn'
                    'gui_Callback'};
gui_Mfile = '';
for i=1:length(gui_StateFields)
    if ~isfield(gui_State, gui_StateFields{i})
        error('Could not find field %s in the gui_State struct in GUI M-file %s', gui_StateFields{i}, gui_Mfile);        
    elseif isequal(gui_StateFields{i}, 'gui_Name')
        gui_Mfile = [gui_State.(gui_StateFields{i}), '.m'];
    end
end

numargin = length(varargin);

if numargin == 0
    
    gui_Create = 1;
elseif isequal(ishandle(varargin{1}), 1) && ispc && iscom(varargin{1}) && isequal(varargin{1},gcbo)
    
    vin{1} = gui_State.gui_Name;
    vin{2} = [get(varargin{1}.Peer, 'Tag'), '_', varargin{end}];
    vin{3} = varargin{1};
    vin{4} = varargin{end-1};
    vin{5} = guidata(varargin{1}.Peer);
    feval(vin{:});
    return;
elseif ischar(varargin{1}) && numargin>1 && isequal(ishandle(varargin{2}), 1)
    
    gui_Create = 0;
else
   
    gui_Create = 1;
end

if gui_Create == 0
    varargin{1} = gui_State.gui_Callback;
    if nargout
        [varargout{1:nargout}] = feval(varargin{:});
    else
        feval(varargin{:});
    end
else
    if gui_State.gui_Singleton
        gui_SingletonOpt = 'reuse';
    else
        gui_SingletonOpt = 'new';
    end
    
   
    if ~isempty(gui_State.gui_LayoutFcn)
        gui_hFigure = feval(gui_State.gui_LayoutFcn, gui_SingletonOpt);
        
        movegui(gui_hFigure,'onscreen')
    else
        gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt);            
            if isappdata(gui_hFigure, 'InGUIInitialization')
            delete(gui_hFigure);
            gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt);            
        end
    end
    
    
    setappdata(gui_hFigure,'InGUIInitialization',1);

    
    gui_Options = getappdata(gui_hFigure,'GUIDEOptions');
    
    if ~isappdata(gui_hFigure,'GUIOnScreen')
        
        if gui_Options.syscolorfig 
            %set(gui_hFigure,'Color', get(0,'DefaultUicontrolBackgroundColor'));
            set(gui_hFigure,'Color', [240 240 240]/255);
        end

        
        guidata(gui_hFigure, guihandles(gui_hFigure));
    end
    
    
    gui_MakeVisible = 1;
    for ind=1:2:length(varargin)
        if length(varargin) == ind
            break;
        end
        len1 = min(length('visible'),length(varargin{ind}));
        len2 = min(length('off'),length(varargin{ind+1}));
        if ischar(varargin{ind}) && ischar(varargin{ind+1}) && ...
                strncmpi(varargin{ind},'visible',len1) && len2 > 1
            if strncmpi(varargin{ind+1},'off',len2)
                gui_MakeVisible = 0;
            elseif strncmpi(varargin{ind+1},'on',len2)
                gui_MakeVisible = 1;
            end
        end
    end
   for index=1:2:length(varargin)
        if length(varargin) == index
            break;
        end
        try set(gui_hFigure, varargin{index}, varargin{index+1}), catch break, end
    end

    
    gui_HandleVisibility = get(gui_hFigure,'HandleVisibility');
    if strcmp(gui_HandleVisibility, 'callback')
        set(gui_hFigure,'HandleVisibility', 'on');
    end
    
    feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
    
    if ishandle(gui_hFigure)
       
        set(gui_hFigure,'HandleVisibility', gui_HandleVisibility);
        
       
        if gui_MakeVisible
            set(gui_hFigure, 'Visible', 'on')
            if gui_Options.singleton 
                setappdata(gui_hFigure,'GUIOnScreen', 1);
            end
        end

      
        rmappdata(gui_hFigure,'InGUIInitialization');
    end
    
  
    if ishandle(gui_hFigure)
        gui_HandleVisibility = get(gui_hFigure,'HandleVisibility');
        if strcmp(gui_HandleVisibility, 'callback')
            set(gui_hFigure,'HandleVisibility', 'on');
        end
        gui_Handles = guidata(gui_hFigure);
    else
        gui_Handles = [];
    end
    
    if nargout
        [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
    else
        feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
    end
    
    if ishandle(gui_hFigure)
        set(gui_hFigure,'HandleVisibility', gui_HandleVisibility);
    end
end    

function gui_hFigure = local_openfig(name, singleton)
try 
    gui_hFigure = openfig(name, singleton, 'auto');
catch
    gui_OldDefaultVisible = get(0,'defaultFigureVisible');
    set(0,'defaultFigureVisible','off');
    gui_hFigure = openfig(name, singleton);
    set(0,'defaultFigureVisible',gui_OldDefaultVisible);
end

Contact us