基于MATLAB控制系统设计实验软件开发_第1页
基于MATLAB控制系统设计实验软件开发_第2页
基于MATLAB控制系统设计实验软件开发_第3页
基于MATLAB控制系统设计实验软件开发_第4页
基于MATLAB控制系统设计实验软件开发_第5页
已阅读5页,还剩54页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、function num,den=cqjz(G,kc,yPmG=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;function varargout

2、= keshe(varargin% KESHE, by itself, creates a new KESHE or raises the existing% singleton*.% H = KESHE returns the handle to a new KESHE or the handle to% the existing singleton*.% KESHE('CALLBACK',hObject,eventData,handles,. calls the local % function named CALLBACK in KESHE.M with the give

3、n input arguments. % KESHE('Property','Value',. creates a new KESHE or raises the % existing singleton*. Starting from the left, property value pairs are% applied to the GUI before keshe_OpeningFunction gets called. An % unrecognized property name or invalid value makes property appl

4、ication% stop. All inputs are passed to keshe_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% Copyright 2002-2003 The MathWorks, Inc.% Edit the above text to modify the re

5、sponse to help keshe% Last Modified by GUIDE v2.5 30-Dec-2009 18:31:42% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, .'gui_Singleton', gui_Singleton, .'gui_OpeningFcn', keshe_OpeningFcn, .'gui_OutputFcn', keshe_Out

6、putFcn, .'gui_LayoutFcn', , .'gui_Callback', ;if nargin && ischar(varargin1gui_State.gui_Callback = str2func(varargin1;endif nargoutvarargout1:nargout = gui_mainfcn(gui_State, varargin:; elsegui_mainfcn(gui_State, varargin:;end% End initialization code - DO NOT EDIT% - Execut

7、es just before keshe is made visible.function keshe_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 GUIDA

8、TA% varargin command line arguments to keshe (see VARARGIN% Choose default command line output for keshehandles.output = hObject;% Update handles structureguidata(hObject, handles;% UIWAIT makes keshe wait for user response (see UIRESUME% uiwait(handles.figure1;% - Outputs from this function are ret

9、urned to the command line. function varargout = keshe_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 G

10、UIDATA% Get default command line output from handles structurevarargout1 = handles.output;% - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles% hObject handle to pushbutton1 (see GCBO% eventdata reserved - to be defined in a future version of MATLAB%

11、handles structure with handles and user data (see GUIDATAfigure(2bode(handles.numh,handles.denh;xlabel('Frequency rad/s','fontsize',10;ylabel('Phase deg Gain dB','fontsize',10;title('Bode Diagram of original signal'guidata(hObject,handles;% - Executes on butto

12、n press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles% 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 GUIDATAfigure(1bode(conv(handles.num,handles.fnum,conv(handle

13、s.den,handles.fden; xlabel('Frequency rad/s','fontsize',10;ylabel('Phase deg Gain dB','fontsize',10;title('Bode Diagram of original signal'guidata(hObject,handles;function edit1_Callback(hObject, eventdata, handles% hObject handle to edit1 (see GCBO% eventdata

14、 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_num=get(hObject,'String'ha

15、ndles.num=str2num(num;guidata(hObject, handles;% - 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 cre

16、ated until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit2_Call

17、back(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&

18、#39; returns contents of edit2 as a% doubleden=get(hObject,'String'handles.den=str2num(den;guidata(hObject, handles;% - Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles% hObject handle to edit2 (see GCBO% eventdata reserved -

19、 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 ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor

20、',get(0,'defaultUicontrolBackgroundColor' ;endfunction 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,'Strin

21、g' 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 b

22、e 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 ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor'

23、,get(0,'defaultUicontrolBackgroundColor' ;endfunction 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'

24、; 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 def

25、ined 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 ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(

26、0,'defaultUicontrolBackgroundColor' ;endfunction edit6_Callback(hObject, eventdata, handles% hObject handle to edit6 (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' ret

27、urns contents of edit6 as text% str2double(get(hObject,'String' returns contents of edit6 as a doublepm=get(hObject,'String'handles.pm=str2num(pm;guidata(hObject, handles;% - Executes during object creation, after setting all properties. function edit6_CreateFcn(hObject, eventdata, h

28、andles% hObject handle to edit6 (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 ispcset(hObject,'Backgroun

29、dColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit7_Callback(hObject, eventdata, handles% hObject handle to edit7 (see GCBO% eventdata reserved - to be defined in a future version of MATLAB% handles structure with ha

30、ndles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit7 as text% str2double(get(hObject,'String' returns contents of edit7 as a doublek=get(hObject,'String'handles.k=str2num(k;guidata(hObject, handles;% - Executes during object creation, after

31、setting all properties. function edit7_CreateFcn(hObject, eventdata, handles% hObject handle to edit7 (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 backgroun

32、d on Windows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit8_Callback(hObject, eventdata, handles% hObject handle to edit8 (see GCBO% eventdata reserved -

33、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 edit8 as text% str2double(get(hObject,'String' returns contents of edit8 as a double% - Executes during object creation, after setti

34、ng all properties. function edit8_CreateFcn(hObject, eventdata, handles% hObject handle to edit8 (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

35、Windows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit9_Callback(hObject, eventdata, handles% hObject handle to edit9 (see GCBO% eventdata reserved - to be

36、 defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit9 as text% str2double(get(hObject,'String' returns contents of edit9 as a double% - Executes during object creation, after setting al

37、l properties. function edit9_CreateFcn(hObject, eventdata, handles% hObject handle to edit9 (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 Windo

38、ws.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit10_Callback(hObject, eventdata, handles% hObject handle to edit10 (see GCBO% eventdata reserved - to be de

39、fined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit10 as text% str2double(get(hObject,'String' returns contents of edit10 as a double% - Executes during object creation, after setting all

40、 properties. function edit10_CreateFcn(hObject, eventdata, handles% hObject handle to edit10 (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 Wind

41、ows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit11_Callback(hObject, eventdata, handles% hObject handle to edit11 (see GCBO% eventdata reserved - to be d

42、efined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit11 as text% str2double(get(hObject,'String' returns contents of edit11 as a double% - Executes during object creation, after setting al

43、l properties. function edit11_CreateFcn(hObject, eventdata, handles% hObject handle to edit11 (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 Win

44、dows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit12_Callback(hObject, eventdata, handles% hObject handle to edit12 (see GCBO% eventdata reserved - to be

45、defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit12 as text% str2double(get(hObject,'String' returns contents of edit12 as a double% - Executes during object creation, after setting a

46、ll properties. function edit12_CreateFcn(hObject, eventdata, handles% hObject handle to edit12 (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 Wi

47、ndows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit13_Callback(hObject, eventdata, handles% hObject handle to edit13 (see GCBO% eventdata reserved - to be

48、 defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit13 as text% str2double(get(hObject,'String' returns contents of edit13 as a double% - Executes during object creation, after setting

49、all properties. function edit13_CreateFcn(hObject, eventdata, handles% hObject handle to edit13 (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 W

50、indows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit14_Callback(hObject, eventdata, handles% hObject handle to edit14 (see GCBO% eventdata reserved - to b

51、e defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit14 as text% str2double(get(hObject,'String' returns contents of edit14 as a double% - Executes during object creation, after setting

52、 all properties. function edit14_CreateFcn(hObject, eventdata, handles% hObject handle to edit14 (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

53、Windows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;endfunction edit15_Callback(hObject, eventdata, handles% hObject handle to edit15 (see GCBO% eventdata reserved - to

54、be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA% Hints: get(hObject,'String' returns contents of edit15 as text% str2double(get(hObject,'String' returns contents of edit15 as a double% - Executes during object creation, after settin

55、g all properties. function edit15_CreateFcn(hObject, eventdata, handles% hObject handle to edit15 (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

56、 Windows.% See ISPC and COMPUTER.if ispcset(hObject,'BackgroundColor','white'elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor' ;end% - Executes during object creation, after setting all properties. function text30_CreateFcn(hObject, eventdata,

57、handles% hObject handle to text30 (see GCBO% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% - Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles% hObject handle to

58、 pushbutton3 (see GCBO% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATAG=tf(conv(handles.num,handles.fnum,conv(handles.den,handles.fden; Gm1,Pm1,Wcg1,Wcp1=margin(G;Gm1=num2str(Gm1;Pm1=num2str(Pm1;Wcg1=num2str(Wcg1;Wcp1=num2s

59、tr(Wcp1;set(handles.textGm1,'string',Gm1;set(handles.textPm1,'string',Pm1;set(handles.textWcg1,'string',Wcg1;set(handles.textWcp1,'string',Wcp1;% - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles% hObject handle to pus

60、hbutton4 (see GCBO% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATAa=handles.numh;b=handles.denh;G=tf(a,b;Gm2,Pm2,Wcg2,Wcp2=margin(G;Gm2=num2str(Gm2;Pm2=num2str(Pm2;Wcg2=num2str(Wcg2;Wcp2=num2str(Wcp2;set(handles.textGm2,'string',Gm2;set(handl

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论