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

📄 wdwucha.m

📁 matlab-gui 自动控制原理-采样控制系统
💻 M
字号:
function varargout = WDwucha(varargin)
% WDWUCHA M-file for WDwucha.fig
%      WDWUCHA, by itself, creates a new WDWUCHA or raises the existing
%      singleton*.
%
%      H = WDWUCHA returns the handle to a new WDWUCHA or the handle to
%      the existing singleton*.
%
%      WDWUCHA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in WDWUCHA.M with the given input arguments.
%
%      WDWUCHA('Property','Value',...) creates a new WDWUCHA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before WDwucha_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to WDwucha_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 WDwucha

% Last Modified by GUIDE v2.5 18-Apr-2006 13:08:45

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @WDwucha_OpeningFcn, ...
                   'gui_OutputFcn',  @WDwucha_OutputFcn, ...
                   'gui_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
% End initialization code - DO NOT EDIT


% --- Executes just before WDwucha is made visible.
function WDwucha_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 WDwucha (see VARARGIN)

% Choose default command line output for WDwucha
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = WDwucha_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;

h3=axes('Position',[0.2,0.48,0.55,0.5]);
set(h3,'Xlim',[0,1.2],'Ylim',[0,0.5])
set(h3,'DataAspectRatio',[1 1 1])
set(h3,'ColorOrder',[0 0 0])
set(h3,'Visible','off')

hh1=rectangle('Position',[0.75,0.2,0.25,0.2],'Curvature',[0,0]);
hh1=rectangle('Position',[0.40,0.2,0.25,0.2],'Curvature',[0,0]);
hh2=rectangle('Position',[0.12,0.27,0.06,0.06],'Curvature',[1,1]);

xx0=0.02:0.01:0.12;xx1=0.18:0.01:0.25;
xx2=0.65:0.02:0.75;xx3=1.0:0.02:1.1;
xx4=0.43:0.02:0.615;xx5=0.79:0.01:0.95;
xx6=0.15:0.02:1.06;yy6=0.1*ones(size(xx6));
yy7=0.1:0.02:0.3;yy8=0.1:0.02:0.27;
xx9=0.298:0.01:0.4;yy9=0.3*ones(size(xx9));

yy0=0.3*ones(size(xx0));yy1=0.3*ones(size(xx1));
yy2=0.3*ones(size(xx2));yy3=0.3*ones(size(xx3));
yy4=0.3*ones(size(xx4));yy5=0.3*ones(size(xx5));
xx7=1.05*ones(size(yy7));xx8=0.15*ones(size(yy8));

line(xx9,yy9);
line(xx0,yy0);line(xx1,yy1);line(xx2,yy2);
line(xx3,yy3);line(xx4,yy4);line(xx5,yy5); 
line(xx7,yy7);line(xx8,yy8);line(xx6,yy6);
line(0.11,0.3,'Marker','>','MarkerFaceColor','k')
line(0.39,0.3,'Marker','>','MarkerFaceColor','k')
line(0.74,0.3,'Marker','>','MarkerFaceColor','k')
line(1.1,0.3,'Marker','>','MarkerFaceColor','k')
line(0.15,0.26,'Marker','^','MarkerFaceColor','k')

text(0.46,0.35,'\fontsize{14}\bf1-e^{-Ts}')
text(0.51,0.26,'\fontsize{12}\bfs')
text(1.13,0.3,'\fontsize{14}\bfy(t)')
text(0.84,0.35,'\fontsize{12}\bf2')
text(0.81,0.26,'\fontsize{12}\bfs(s+1)');
text(0.16,0.24,'\fontsize{20}\bf-');
text(0.13,0.3,'\fontsize{20}X');
text(0.248,0.325,'\fontsize{22}/');




% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
num=[2];den=[0.1,1,0];T=0.1
[numZ,denZ]=c2dm(num,den,T,'zoh');
printsys(numZ,denZ,'Z')
[z,p,k]=tf2zp(numZ,denZ);
p1=findobj('tag','text4');
set(p1,'string',mat2str(p));






% hObject    handle to pushbutton1 (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 pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
p2=get(findobj('tag','popupmenu1'),'Value');
b1=findobj('tag','text12')
t8=findobj('tag','text8');
g_1=(0.074+0.053)/(1-0.368);

switch p2
    case 1
        set(t8,'string','');
        set(b1,'string','');
    case 2
        set(t8,'string',0);
       
        set(b1,'string',1+g_1);
    case 3
        set(t8,'string',1);
        set(b1,'string',0);
    case 4
        set(t8,'string',2);
        set(b1,'string',0);
    otherwise
        set(t8,'string','2以上');
        set(b1,'string','');
end
 

% hObject    handle to pushbutton2 (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 pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
p2=get(findobj('tag','popupmenu1'),'Value');
b2=findobj('tag','text13')
g_1=(0.074+0.053)/(1-0.368);
T=0.1;
switch p2
    case 1
        set(b2,'string',' ');
    case 2
       
       
        set(b2,'string','无穷大');
    case 3
        
        set(b2,'string',T/g_1);
    case 4
        
        set(b2,'string',0);
    otherwise
        
        set(b2,'string',0);
end
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)





function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


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



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


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


% --- 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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function text8_Callback(hObject, eventdata, handles)


% hObject    handle to text8 (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 text8 as text
%        str2double(get(hObject,'String')) returns contents of text8 as a double





function edit3_Callback(hObject, eventdata, handles)

% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


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

% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
p2=get(findobj('tag','popupmenu1'),'Value');
b3=findobj('tag','text15')
g_1=(0.074+0.053)/(1-0.368);
T=0.1;
switch p2
    case 1
        set(b3,'string',' ');
    case 2
       
       
        set(b3,'string','无穷大');
    case 3
        
        set(b3,'string','无穷大');
    case 4
        
        set(b3,'string',T^2/g_1);
    otherwise
        
        set(b3,'string',0);
end


function edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (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 during object creation, after setting all properties.
function text15_CreateFcn(hObject, eventdata, handles)
% hObject    handle to text15 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


⌨️ 快捷键说明

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