自动控制原理(课程设计)一、题目用MATLAB创建用户界面,并完成以下功能:(1)由用户输入被控系统的状态空间模型、闭环系统希望的一组极点;(2)显示未综合系统的单位阶跃响应曲线;(3)显示采用一般设计方法得到的状态反馈矩阵参数;(4)显示闭环反馈系统的单位阶跃响应曲线;(5)将该子系统嵌入到寒假作业中程序中。
分别对固定阶次和任意阶次的被控系统进行设计。
分别给出设计实例。
二、运行结果界面:如图由用户输入被控系统的状态空间模型、闭环系统希望的一组极点例如,输入010001034A⎡⎤⎢⎥=⎢⎥⎢⎥--⎣⎦,1B⎡⎤⎢⎥=⎢⎥⎢⎥⎣⎦,[]2000C=,0D=,闭环系统希望的一组极点:22j-+、22j--、5-如图所示:被控系统的单位阶跃响应曲线闭环系统的单位阶跃响应曲线状态反馈矩阵显示三、讨论该闭环控制系统的状态反馈与极点配置设计系统可用于任意阶次的控制系统。
在此之前,我还做了一个固定阶次的控制系统状态反馈与极点配置的Matlab 控制台程序(见附录二)。
该系统的利用状态反馈进行极点任意配置所采用的方法为一般方法,其步骤如下:①判断受控系统是否完全能控;②由给定的闭环极点要求确定希望的闭环特征多项式的n个系数~i a;③确定原受控系统的特征多项式系数ia;④确定系统状态反馈矩阵~~~~[,,,]12nff fF=的诸元素~~11ii if a a-=--;⑤确定原受控系统化为能控标准形的变换阵的逆1P-,⑥确定受控系统完成闭环极点配置任务的状态反馈阵~1F F P-=。
四、参考文献[1]黄家英.《自动控制原理》.高等教育出版社,2010.5[2]唐向红,郑雪峰.《MATLAB及在电子信息类》.电子工业出版社,2009.6[3]吴大正,高西全.《MATLAB新编教程》.机械工业出版社,2008.4五、附录function varargout = tufeiqiang(varargin)%TUFEIQIANG M-file for tufeiqiang.fig% TUFEIQIANG, by itself, creates a new TUFEIQIANG or raises the existing% singleton*.%% H = TUFEIQIANG returns the handle to a new TUFEIQIANG or the handle to% the existing singleton*.%% TUFEIQIANG('Property','Value',...) creates a new TUFEIQIANG usingthe% given property value pairs. Unrecognized properties are passed via % varargin to tufeiqiang_OpeningFcn. This calling syntax produces a% warning when there is an existing singleton*.%% TUFEIQIANG('CALLBACK') and TUFEIQIANG('CALLBACK',hObject,...) call the% local function named CALLBACK in TUFEIQIANG.M with the given input % arguments.%% *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 tufeiqiang% Last Modified by GUIDE v2.5 20-May-2015 23:49:56% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @tufeiqiang_OpeningFcn, ...'gui_OutputFcn', @tufeiqiang_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{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before tufeiqiang is made visible.function tufeiqiang_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 unrecognized PropertyName/PropertyValue pairs from the% command line (see VARARGIN)% Choose default command line output for tufeiqianghandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes tufeiqiang wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line. function varargout = tufeiqiang_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;function WZH_Callback(hObject, eventdata, handles)% hObject handle to WZH (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)A=get(handles.edit1,'String');A=char(A);A=str2num(A);B=get(handles.edit2,'String');B=char(B);B=str2num(B);C=get(handles.edit3,'String');C=char(C);C=str2num(C);D=get(handles.edit4,'String');D=char(D);D=str2num(D);sys = ss(A,B,C,D);axes(handles.axes1);set(handles.axes1,'unit','normalized');step(sys);%title('••ו•••••••••••ו••ì•••ú••')set(findobj(gca,'Type','line','Color',[0 0 1]),...'Color','red',...'LineWidth',2)% --- Executes on button press in BFK.function BFK_Callback(hObject, eventdata, handles)% hObject handle to BFK (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)A=get(handles.edit1,'String');A=char(A);A=str2num(A);B=get(handles.edit2,'String');B=char(B);B=str2num(B);C=get(handles.edit3,'String');C=char(C);C=str2num(C);D=get(handles.edit4,'String');D=char(D);D=str2num(D);P=get(handles.edit5,'String');P=char(P);P=str2num(P);K = acker(A,B,P);at = A-B*K;bt = B;ct = C;dt = D;%[num,den]=zp2tf(z,p,k);%[num1,den1]=cloop(num,den);axes(handles.axes1);set(handles.axes1,'unit','normalized');%step(cloop(num,den));%rlocus(A,B,K,0)%step(num1,den1);sys = ss(at,bt,ct,dt);step(sys);title('±••··••••••••••••ו••ì•••ú••')set(findobj(gca,'Type','line','Color',[0 3 3]),...'Color','yellow',...'LineWidth',2)function FKC_Callback(hObject, eventdata, handles)% hObject handle to FKC (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)A=get(handles.edit1,'String');A=char(A);A=str2num(A);B=get(handles.edit2,'String');B=char(B);B=str2num(B);Z=get(handles.edit5,'String');Z=char(Z);Z=str2num(Z);Zif rank(ctrb(A,B)) == rank(A)N = acker(A,B,Z);Nstr=num2str(N)H = findobj('tag','edit6');set(H,'string',str);elsemsgbox('•••••••••••••••••••••••• ');endfunction pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)A=get(handles.edit1,'String');AA=char(A);AA=str2num(A);AB=get(handles.edit2,'String');BB=char(B);BB=str2num(B);BM = ctrb(A,B);if rank(M) == rank(A)msgbox('•••••ê••••••••••••••••••');%[num,den]=zp2tf(z,p,k);%[num1,den1]=cloop(num,den);%step(cloop(num,den));%rlocus(A,B,K,0)%step(num1,den1);elsemsgbox('•••••••••••••••••••••••• '); end。