⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 new2.m

📁 现代控制原理中线性时不变系统分析与设计软件的MATLAB GUI设计M文件
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = new(varargin)% NEW M-file for new.fig%      NEW, by itself, creates a new NEW or raises the existing%      singleton*.%%      H = NEW returns the handle to a new NEW or the handle to%      the existing singleton*.%%      NEW('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in NEW.M with the given input arguments.%%      NEW('Property','Value',...) creates a new NEW or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before new_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to new_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 new% Last Modified by GUIDE v2.5 13-May-2009 21:35:45% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @new_OpeningFcn, ...                   'gui_OutputFcn',  @new_OutputFcn, ...                   'gui_LayoutFcn',  [] , ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})    gui_State.gui_Callback = str2func(varargin{1});endif 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 new is made visible.function new_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 new (see VARARGIN)% Choose default command line output for newhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes new wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = new_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 structurevarargout{1} = handles.output;% --- Executes on button press in tf2ss.function tf2ss_Callback(hObject, eventdata, handles)num=str2num(get(handles.num,'string'));den=str2num(get(handles.den,'string'));[a,b,c,d]=tf2ss(num,den);set(handles.amatrix,'string',num2str(a));set(handles.bmatrix,'string',num2str(b));set(handles.cmatrix,'string',num2str(c));set(handles.dmatrix,'string',num2str(d));% hObject    handle to tf2ss (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in ss2tf.function ss2tf_Callback(hObject, eventdata, handles)a=str2num(get(handles.amatrix2,'string'));b=str2num(get(handles.bmatrix2,'string'));c=str2num(get(handles.cmatrix2,'string'));d=str2num(get(handles.dmatrix2,'string'));[nu,de]=ss2tf(a,b,c,d);set(handles.num,'string',num2str(nu));set(handles.den,'string',num2str(de));% hObject    handle to ss2tf (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes on selection change in dmatrix.function dmatrix_Callback(hObject, eventdata, handles)% hObject    handle to dmatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns dmatrix contents as cell array%        contents{get(hObject,'Value')} returns selected item from dmatrix% --- Executes during object creation, after setting all properties.function dmatrix_CreateFcn(hObject, eventdata, handles)% hObject    handle to dmatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end% --- Executes on selection change in cmatrix.function cmatrix_Callback(hObject, eventdata, handles)% hObject    handle to cmatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns cmatrix contents as cell array%        contents{get(hObject,'Value')} returns selected item from cmatrix% --- Executes during object creation, after setting all properties.function cmatrix_CreateFcn(hObject, eventdata, handles)% hObject    handle to cmatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end% --- Executes on selection change in bmatrix.function bmatrix_Callback(hObject, eventdata, handles)% hObject    handle to bmatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns bmatrix contents as cell array%        contents{get(hObject,'Value')} returns selected item from bmatrix% --- Executes during object creation, after setting all properties.function bmatrix_CreateFcn(hObject, eventdata, handles)% hObject    handle to bmatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end% --- Executes on selection change in amatrix.function amatrix_Callback(hObject, eventdata, handles)% hObject    handle to amatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns amatrix contents as cell array%        contents{get(hObject,'Value')} returns selected item from amatrix% --- Executes during object creation, after setting all properties.function amatrix_CreateFcn(hObject, eventdata, handles)% hObject    handle to amatrix (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: listbox controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction num_Callback(hObject, eventdata, handles)% hObject    handle to num (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 num as text%        str2double(get(hObject,'String')) returns contents of num as a double% --- Executes during object creation, after setting all properties.function num_CreateFcn(hObject, eventdata, handles)% hObject    handle to num (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction den_Callback(hObject, eventdata, handles)% hObject    handle to den (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 den as text%        str2double(get(hObject,'String')) returns contents of den as a double% --- Executes during object creation, after setting all properties.function den_CreateFcn(hObject, eventdata, handles)% hObject    handle to den (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction amatrix2_Callback(hObject, eventdata, handles)% hObject    handle to amatrix2 (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 amatrix2 as text%        str2double(get(hObject,'String')) returns contents of amatrix2 as a double% --- Executes during object creation, after setting all properties.function amatrix2_CreateFcn(hObject, eventdata, handles)% hObject    handle to amatrix2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction bmatrix2_Callback(hObject, eventdata, handles)% hObject    handle to bmatrix2 (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 bmatrix2 as text%        str2double(get(hObject,'String')) returns contents of bmatrix2 as a double% --- Executes during object creation, after setting all properties.function bmatrix2_CreateFcn(hObject, eventdata, handles)% hObject    handle to bmatrix2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction dmatrix2_Callback(hObject, eventdata, handles)% hObject    handle to dmatrix2 (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 dmatrix2 as text%        str2double(get(hObject,'String')) returns contents of dmatrix2 as a double% --- Executes during object creation, after setting all properties.function dmatrix2_CreateFcn(hObject, eventdata, handles)% hObject    handle to dmatrix2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');endfunction cmatrix2_Callback(hObject, eventdata, handles)% hObject    handle to cmatrix2 (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 cmatrix2 as text%        str2double(get(hObject,'String')) returns contents of cmatrix2 as a double% --- Executes during object creation, after setting all properties.function cmatrix2_CreateFcn(hObject, eventdata, handles)% hObject    handle to cmatrix2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor','white');end% --- Executes on button press in controll_pb.function controll_pb_Callback(hObject, eventdata, handles)A=str2num(get(handles.amatrix2,'string'));B=str2num(get(handles.bmatrix2,'string'));C=str2num(get(handles.cmatrix2,'string'));D=0;N=size(A);n=N(1);CAM=ctrb(A,B);if det(CAM)~=0  rcam=rank(CAM)  if rcam==n   set(handles.result_c,'string','系统是可控的')   elseif rcam<n   set(handles.result_c,'string','系统是不可控的')   endelseif det(CAM)==0set(handles.result_c,'string','系统是可控的')end% hObject    handle to controll_pb (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)function result_c_Callback(hObject, eventdata, handles)% hObject    handle to result_c (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 result_c as text%        str2double(get(hObject,'String')) returns contents of result_c as a double% --- Executes during object creation, after setting all properties.function result_c_CreateFcn(hObject, eventdata, handles)% hObject    handle to result_c (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -