analyse.m
function varargout = analyse(varargin)
% ANALYSE M-file for analyse.fig
% ANALYSE, by itself, creates a new ANALYSE or raises the existing
%singleton*.
%
%H = ANALYSE returns the handle to a new ANALYSE or the handle to
%the existing singleton*.
%
% ANALYSE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in ANALYSE.M with the given input arguments.
%
%ANALYSE('Property','Value',...) creates a new ANALYSE or raises the
%existing singleton*. Starting from the left, property value pairs are
%applied to the GUI before analyse_OpeningFunction gets called. An
%unrecognized property name or invalid value makes property application
%stop. All inputs are passed to analyse_OpeningFcn via varargin.
%
%*See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
%instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help analyse 6
% Last Modified by GUIDE v2.5 21-Dec-2008 01:01:32
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename,...
'gui_Singleton', gui_Singleton,...
'gui_OpeningFcn', @analyse_OpeningFcn,...
'gui_OutputFcn', @analyse_OutputFcn,...
'gui_LayoutFcn', [],...
'gui_Callback', []);
if nargin & isstr(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
% End initialization code - DO NOT EDIT
% --- Executes just before analyse is made visible.
function analyse_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to analyse (see VARARGIN)
% Choose default command line output for analyse
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes analyse wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = analyse_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in rbUst.
function rbUst_Callback(hObject, eventdata, handles)
% hObject handle to rbUst (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbUst
% Переключатель, событие которого обрабатывается, должен
% включиться, а остальные сброситься
set(handles.rbUst, 'Value', 1)
set(handles.rbUpr, 'Value', 0)
set(handles.rbNab, 'Value', 0)
% --- Executes on button press in rbUpr.
function rbUpr_Callback(hObject, eventdata, handles)
% hObject handle to rbUpr (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbUpr
% Переключатель, событие которого обрабатывается, должен
% включиться, а остальные сброситься
set(handles.rbUst, 'Value', 0)
set(handles.rbUpr, 'Value', 1)
set(handles.rbNab, 'Value', 0)
% --- Executes on button press in rbNab.
function rbNab_Callback(hObject, eventdata, handles)
% hObject handle to rbNab (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rbNab 7
% Переключатель, событие которого обрабатывается, должен
% включиться, а остальные сброситься
set(handles.rbUst, 'Value', 0)
set(handles.rbUpr, 'Value', 0)
set(handles.rbNab, 'Value', 1)
% --- Executes on button press in pbScore.
function pbScore_Callback(hObject, eventdata, handles)
% hObject handle to pbScore (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data = getappdata(gcbf, 'matrix');
% Проверка флага Устойчивость
if get(handles.rbUst,'Value')
% определение степени устойчивости
r=1-max(abs(eig(data.a)));
step_ust = r;
if step_ust==0
info='система нейтральна, т.к. степень устойчивости равна 0';
else
if step_ust < 0
info='система неустойчива, т.к. степень устойчивости меньше 0';
else
info='система устойчива, т.к. степень устойчивости в интервале (0;1)';
end
end
set(handles.etInfo, 'String',sprintf('step_ust=%0.4g; %s',step_ust,info));
end
% Проверка флага Управляемость
if get(handles.rbUpr,'Value')
% определение управляемости
G=ctrb(data.a,data.b');
if rank(G)==size(data.a,1)
info='система управляема';
else
info='система не управляема';
end
set(handles.etInfo, 'String',sprintf('%s',info));
end
% Проверка флага Наблюдаемость
if get(handles.rbNab,'Value')
% определение управляемости
H=obsv(data.a,data.c)';
if rank(H)==size(data.a,1)
info='система наблюдаема';
else
info='система не наблюдаема';
end
set(handles.etInfo, 'String',sprintf('%s',info));
end
% --- Executes during object creation, after setting all properties.
function etInfo_CreateFcn(hObject, eventdata, handles)
% hObject handle to etInfo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function etInfo_Callback(hObject, eventdata, handles)
% hObject handle to etInfo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of etInfo as text
% str2double(get(hObject,'String')) returns contents of etInfo as a double
% --- Executes during object creation, after setting all properties.
function etA_CreateFcn(hObject, eventdata, handles)
% hObject handle to etA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER. 8
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function etA_Callback(hObject, eventdata, handles)
% hObject handle to etA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of etA as text
% str2double(get(hObject,'String')) returns contents of etA as a double
a = str2num(get(hObject, 'String'));
data = getappdata(gcbf, 'matrix');
data.a = a;
k=0;
% перевод вектора в матрицу
for i=1:sqrt(length(data.a))
for j=1:sqrt(length(data.a))
g(i,j)=data.a(k+1);
k=k+1;
end
end
data.a = g;
setappdata(gcbf, 'matrix', data);
% --- Executes during object creation, after setting all properties.
function etB_CreateFcn(hObject, eventdata, handles)
% hObject handle to etB (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function etB_Callback(hObject, eventdata, handles)
% hObject handle to etB (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of etB as text
% str2double(get(hObject,'String')) returns contents of etB as a double
b = str2num(get(hObject, 'String'));
data = getappdata(gcbf, 'matrix');
data.b = b;
setappdata(gcbf, 'matrix', data);
% --- Executes during object creation, after setting all properties.
function etC_CreateFcn(hObject, eventdata, handles)
% hObject handle to etC (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function etC_Callback(hObject, eventdata, handles)
% hObject handle to etC (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of etC as text
% str2double(get(hObject,'String')) returns contents of etC as a double 9
c = str2num(get(hObject, 'String'));
data = getappdata(gcbf, 'matrix');
data.c = c;
setappdata(gcbf, 'matrix', data);