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

📄 nipidgui.m

📁 国外人编写的一个分数阶系统的控制工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = nipidGui(varargin)
% NIPIDGUI M-file for nipidGui.fig
%      NIPIDGUI, by itself, creates a new NIPIDGUI or raises the existing
%      singleton*.
%
%      H = NIPIDGUI returns the handle to a new NIPIDGUI or the handle to
%      the existing singleton*.
%
%      NIPIDGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in NIPIDGUI.M with the given input arguments.
%
%      NIPIDGUI('Property','Value',...) creates a new NIPIDGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before nipidGui_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to nipidGui_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 nipidGui

% Last Modified by GUIDE v2.5 05-Aug-2005 18:26:37

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @nipidGui_OpeningFcn, ...
                   'gui_OutputFcn',  @nipidGui_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 nipidGui is made visible.
function nipidGui_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 nipidGui (see VARARGIN)

% Choose default command line output for nipidGui
handles.output = tf(0);

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes nipidGui wait for user response (see UIRESUME)
uiwait(handles.nipidGui);


% --- Outputs from this function are returned to the command line.
function varargout = nipidGui_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
if ~isempty(handles)
    varargout{1} = handles.output;
    delete(handles.nipidGui);
else
    varargout{1} = tf(0);
end

% --- Executes during object creation, after setting all properties.
function edit_wl_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_wl (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



% --- Executes during object creation, after setting all properties.
function edit_wh_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_wh (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



% --- Executes during object creation, after setting all properties.
function edit_Ts_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_Ts (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all Creat
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



% --- Executes during object creation, after setting all properties.
function edit_wc_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_wc (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



% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (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 popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
formula = get(hObject, 'Value');
switch formula
    case {1, 3, 4, 5} % CRONE, Matsuda, high and low-frequency CFE
        set(handles.edit_wl, 'Enable', 'on');
        set(handles.edit_wh, 'Enable', 'on');
        set(handles.edit_Ts, 'Enable', 'off');
        set(handles.popupmenu2, 'Enable', 'off');
        set(handles.text_warn, 'Visible', 'off');
    case 2 % Carlson
        set(handles.edit_wl, 'Enable', 'on');
        set(handles.edit_wh, 'Enable', 'on');
        set(handles.edit_Ts, 'Enable', 'off');
        set(handles.popupmenu2, 'Enable', 'off');
        set(handles.text_warn, 'Visible', 'on');
    case {6, 7, 8, 9, 10, 11} % backwards finite differences, Tustin, Simpson, delta
        set(handles.edit_wl, 'Enable', 'off');
        set(handles.edit_wh, 'Enable', 'off');
        set(handles.edit_Ts, 'Enable', 'on');
        set(handles.popupmenu2, 'String', {'MacLaurin series expansion',...
                'Continued fraction expansion',...
                'Inverted MacLaurin series expansion',...
                'Inverted continued fraction expansion'});
        set(handles.popupmenu2, 'Enable', 'on');
        set(handles.text_warn, 'Visible', 'off');
    case {12, 13} % impulse response, step response
        set(handles.edit_wl, 'Enable', 'off');
        set(handles.edit_wh, 'Enable', 'off');
        set(handles.edit_Ts, 'Enable', 'on');
        set(handles.popupmenu2, 'String', {'Time series',...
                'Continued fraction expansion',...
                'Inverted time series',...
                'Inverted continued fraction expansion'});
        set(handles.popupmenu2, 'Enable', 'on');
        set(handles.text_warn, 'Visible', 'off');
end


% --- Executes on button press in pushbutton_OK.
function pushbutton_OK_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_OK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
kp = str2double(get(handles.edit_P, 'String'));
if isnan(kp)
    errordlg('Provide a valid real number for parameter P.', 'Error with kp', 'modal')
    return
end
ki = str2double(get(handles.edit_I, 'String'));
if isnan(ki)

⌨️ 快捷键说明

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