基于MATLAB控制系统设计实验软件开发精.docx
- 文档编号:10157377
- 上传时间:2023-05-24
- 格式:DOCX
- 页数:44
- 大小:19.99KB
基于MATLAB控制系统设计实验软件开发精.docx
《基于MATLAB控制系统设计实验软件开发精.docx》由会员分享,可在线阅读,更多相关《基于MATLAB控制系统设计实验软件开发精.docx(44页珍藏版)》请在冰点文库上搜索。
基于MATLAB控制系统设计实验软件开发精
Cqjz.m
function[num,den]=cqjz(G,kc,yPm
G=tf(G;
[mag,pha,w]=bode(G*kc;
Mag=20*log10(mag;
[Gm,Pm,Wcg,Wcp]=margin(G*kc;
%phi=(yPm-getfield(Pm,'Wcg'*pi/180;
phi=(yPm+5-Pm*pi/180;
alpha=(1+sin(phi/(1-sin(phi;
Mn=-10*log10(alpha;
Wcgn=spline(Mag,w,Mn;
T=1/(Wcgn*sqrt(alpha;
Tz=alpha*T;
num=[Tz,1];
den=[T,1];
keshe.m
functionvarargout=keshe(varargin
%KESHEM-fileforkeshe.fig
%KESHE,byitself,createsanewKESHEorraisestheexisting
%singleton*.
%
%H=KESHEreturnsthehandletoanewKESHEorthehandleto
%theexistingsingleton*.
%
%KESHE('CALLBACK',hObject,eventData,handles,...callsthelocal%functionnamedCALLBACKinKESHE.Mwiththegiveninputarguments.%
%KESHE('Property','Value',...createsanewKESHEorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare
%appliedtotheGUIbeforekeshe_OpeningFunctiongetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication
%stop.Allinputsarepassedtokeshe_OpeningFcnviavarargin.
%
%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone
%instancetorun(singleton".
%
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%Copyright2002-2003TheMathWorks,Inc.
%Edittheabovetexttomodifytheresponsetohelpkeshe
%LastModifiedbyGUIDEv2.530-Dec-200918:
31:
42
%Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('gui_Name',mfilename,...
'gui_Singleton',gui_Singleton,...
'gui_OpeningFcn',@keshe_OpeningFcn,...
'gui_OutputFcn',@keshe_OutputFcn,...
'gui_LayoutFcn',[],...
'gui_Callback',[];
ifnargin&&ischar(varargin{1}
gui_State.gui_Callback=str2func(varargin{1};
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
};else
gui_mainfcn(gui_State,varargin{:
};
end
%Endinitializationcode-DONOTEDIT
%---Executesjustbeforekesheismadevisible.
functionkeshe_OpeningFcn(hObject,eventdata,handles,varargin
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA
%varargincommandlineargumentstokeshe(seeVARARGIN
%Choosedefaultcommandlineoutputforkeshe
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles;
%UIWAITmakeskeshewaitforuserresponse(seeUIRESUME
%uiwait(handles.figure1;
%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=keshe_OutputFcn(hObject,eventdata,handles
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT;
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%---Executesonbuttonpressinpushbutton1.
functionpushbutton1_Callback(hObject,eventdata,handles
%hObjecthandletopushbutton1(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
figure(2
bode(handles.numh,handles.denh;
xlabel('Frequencyrad/s','fontsize',10;
ylabel('PhasedegGaindB','fontsize',10;
title('BodeDiagramoforiginalsignal';
guidata(hObject,handles;
%---Executesonbuttonpressinpushbutton2.
functionpushbutton2_Callback(hObject,eventdata,handles
%hObjecthandletopushbutton2(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
figure(1
bode(conv(handles.num,handles.fnum,conv(handles.den,handles.fden;xlabel('Frequencyrad/s','fontsize',10;
ylabel('PhasedegGaindB','fontsize',10;
title('BodeDiagramoforiginalsignal';
guidata(hObject,handles;
functionedit1_Callback(hObject,eventdata,handles
%hObjecthandletoedit1(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit1astext
%str2double(get(hObject,'String'returnscontentsofedit1asa
%double__
num=get(hObject,'String';
handles.num=str2num(num;
guidata(hObject,handles;
%---Executesduringobjectcreation,aftersettingallproperties.functionedit1_CreateFcn(hObject,eventdata,handles
%hObjecthandletoedit1(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc
set(hObject,'BackgroundColor','white';
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor';
end
functionedit2_Callback(hObject,eventdata,handles
%hObjecthandletoedit2(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit2astext
%str2double(get(hObject,'String'returnscontentsofedit2asa
%double
den=get(hObject,'String';
handles.den=str2num(den;
guidata(hObject,handles;
%---Executesduringobjectcreation,aftersettingallproperties.functionedit2_CreateFcn(hObject,eventdata,handles
%hObjecthandletoedit2(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc
set(hObject,'BackgroundColor','white';
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor';
end
functionedit3_Callback(hObject,eventdata,handles
%hObjecthandletoedit3(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit3astext
%str2double(get(hObject,'String'returnscontentsofedit3asadouble
%---Executesduringobjectcreation,aftersettingallproperties.functionedit3_CreateFcn(hObject,eventdata,handles
%hObjecthandletoedit3(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc
set(hObject,'BackgroundColor','white';
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor';
end
functionedit4_Callback(hObject,eventdata,handles
%hObjecthandletoedit4(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit4astext
%str2double(get(hObject,'String'returnscontentsofedit4asadouble
%---Executesduringobjectcreation,aftersettingallproperties.functionedit4_CreateFcn(hObject,eventdata,handles
%hObjecthandletoedit4(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc
set(hObject,'BackgroundColor','white';
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor';
end
functionedit6_Callback(hObject,eventdata,handles
%hObjecthandletoedit6(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit6astext
%str2double(get(hObject,'String'returnscontentsofedit6asadouble
pm=get(hObject,'String';
handles.pm=str2num(pm;
guidata(hObject,handles;
%---Executesduringobjectcreation,aftersettingallproperties.functionedit6_CreateFcn(hObject,eventdata,handles
%hObjecthandletoedit6(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc
set(hObject,'BackgroundColor','white';
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor';
end
functionedit7_Callback(hObject,eventdata,handles
%hObjecthandletoedit7(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit7astext
%str2double(get(hObject,'String'returnscontentsofedit7asadouble
k=get(hObject,'String';
handles.k=str2num(k;
guidata(hObject,handles;
%---Executesduringobjectcreation,aftersettingallproperties.functionedit7_CreateFcn(hObject,eventdata,handles
%hObjecthandletoedit7(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
editcontrolsusuallyhaveawhitebackgroundonWindows.
%SeeISPCandCOMPUTER.
ifispc
set(hObject,'BackgroundColor','white';
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor';
end
functionedit8_Callback(hObject,eventdata,handles
%hObjecthandletoedit8(seeGCBO
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA
%Hints:
get(hObject,'String'returnscontentsofedit8astext
%str2double(get(hObject,'String'returnscontentsofedit8asadouble
%---Executesduringobjectcreation,aftersettingallproperties.functionedit8_CreateF
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 MATLAB 控制系统 设计 实验 软件 开发