声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2800|回复: 4

[振动控制] MATLAB 中控制系统命令介绍

[复制链接]
发表于 2012-6-6 20:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
%%%%%%%%%%%%%%%% MATLAB 中系统各种建模命令%%%%%%%%%%%%55

clc
clear all
close all
%MAlTab control
%matlab has a command to obtain the partial-fraction expansion of B(s)/A(s)
%and obtain the zeros and poles of B(s)/A(s)
den=[0 1 2 3];num=[1 3 3 1];
[r,p,k]=residue(den,num);
[den,num]=residue(r,p,k);
%note this command can convers the partial-fraction expansion back to the polyynomial radio
%B(s)/A(s).
printsys(den,num,'s');
%this command prints num/den in the terms of the radio of polynomial in s
num=[1 8 23];den=[1 68 1];
[z,p,k]=tf2zp(num,den);
%this command use to finding zeros and poles of B(s)/A(s); where the K
%inplay the gain :bo note this
%of course have ,if the zeros poles and gain K are given ,then the
%following program will yield the original num/den
[num,den]=zp2tf(z,p,k);
% be note when the resule of K=[1 2 3];means that F=s^2+2*s+3+...;
%note that i only the roots o a polynomial such as
clc
clear all
syms
d=[1 2 3 4];
r=roots(d);
d=poly(r);
%the command poly(r) produces the original polynomial


%2-2: 动力系统的数学模型
%MATLAB has usefull command to transform a mathematical modal of a
%linear-time-invariant system to another model .the folowing only suit to
%the linear system
% tf2ss  : ss2tf conversion  between state-space and transfer-function
% ss2zp :zp2ss   conversion between state-space and zero-pole
% tf2zp :zp2tf  
%c2d continuous-time to dicrete -time conversion

%it is impotant to note that state-space representation of any systems is
%not unique.
A=[0 1;-2 -3];B=[1 0;0 1];
C=[1 0; 0 1];D=[0 0;0 0];
[num,den]=ss2tf(A,B,C,D,1);
%transformation from stste space to transfer function,the iu must be
%speccified for system with more than one iuput
%consider a system eith multiple inouts and multiple outputs.when the
%system has more than one output ,the command produces transfer function
%for all outputs to each input;

%conversion from continuous time to discrete time
A=[0 1;-25 -4];B=[0;1];
%farmat long
[G,H]=c2d(A,B,0.05);
%where 0.05 is the sampling period; assuming a zero-order hold on the
%inputs. now have X(k+1)=G*X(k)+H*u(k); from system Dx=A*X+B*X
%note if we use the farmat long wo would have a more accurate H matrix

%2-3 系统的框图表示
%systems representations by nlock diagrams; Block diagrams of system can be
%in given by transfer system or defined by state space form
%in matlab uses sys to represent such system the statement:
clear all
num=[1 12 13];den=[1 2 3];
sys=tf(num,den);
sy=tf(den,num);
A=[1 1;1 2];B=[1 ;2];C=[1 0];D=[0];
sys1=ss(A,B,C,D);
%any linear invariant system may be repreented by combination of series
%connected blocks and parallel connected block and feedback-connected
%blocks.
sys11=series(sys,sys1);
sys=parallel(sys,sy);
sys=feedback(sys,sy,+1)
%note that in treating the feedback system,matlab assumed that the feedback
%was negative .if the system involves a positve feedback we need to add +1

%pole-zero cancellation ,the cancellation command minreal .this command
%performs the zoro pole cancellation does occur,the cancelled expression
%can be obtained by use ,produces the minimal_odred transfer function . the
%common factors be cancell.
sys=minreal(sys);


% 3 时域分析



%matlab approach to the state_space design of control systems
%matlab is usefull to the controllability and observability of any linear
%time_invariant system and also usefull to designing observers and observer
%controllers.
% a system is said to said be controllable at time to if it is possible to
% transfer the system from any initinal state x(t0) to any other state in a
% finite interval of time by means of an unconstrained control  vector.
%a system is said to be observable at time to if it is possible to dermine
%the state x(t0) of the system from the observation of the output over
%afinite time interval,.therefor the system is completely observable if
%every transition of the state eventually affects every element of the
%output vector

%we now shall derive the condition for completelystate controllable,without
%loss of generality,we can assume that the finial state is the orgin of the
%state space and intinial time is zero .
%and from the preceding annalysis,we can state the condition for complete state controllability
%as follows:the system given by equation is completely state controballe if
%and only if the vectors [B AB A^2B>>>>>A^n-1*B] are linearly
%independent,or the n*n matrix is of rank matrix.
%from the foregoing anlysis we can state the conditions for complete
%observability as follows :[C C*A >>>>>C*A^(n-1)];A=n*n
%is of rank n or have linerly independant column vectors.
%command
A=[0 1 0;
    0 0 1;
    -6 -11 -6];
B=[0 0 1].';
C=[5 6 1];
D=[0];
cont=ctrb(A,B);
a=rank(cont);
obser=obsv(A,C);
b=rank(obser);
[num,den]=ss2tf(A,B,C,D);
sys=tf(num,den);
sys_min=minreal(sys);
%if rank cont of obser is less than n where n is the order of the system,the system is not controllabke
%and not observable,respectively. in terms of transfer function ,if the
%rank of ...is less than n,there is a cancellation of terms in the
%numerator and denominator of the transfer function

%6-3)pole_placement
%if the systems considered is completely state controllable ,then poles of
%the closed_loop system may be placed at any desired location by means of
%state feedback throught an approprate state feedback gain matrix.
%the present design technique begins with a determination of the desried
%closed-loop poles based on the the transient response or frequency response requiments
%such as speed damping radio and bandwith as well as steady state
%requirements,
%in this chapter wo limit our discussion on singel input and single output
%system.when the control signal is a vector quantity the state feedback
%gain matrix is not unique:>>>

%the frist step in the pole_placement design approch is to choose the
%location of the desired closed_loop poles.  the most frequency useed
%approch is to choose such poles on the basis of experience in root locus
%design ,placing a domiant pair of closed loop poles and choosing.
%note that if we place the dominant closed loop poles far from the jw_axis
%so that the system response becomes very fast,the signals in the system
%becomes very large,with the result the system may be bocome nonlinear,this
%should be avioded.and high speed response requiring the large amount of
%control energy,also heavier actuator which will cost more
%example:
clc
clear all
close all
A=[0 1 0;
     0 0 1;
     -1 -5 -6;];
B=[0 0 1;].';
%these system uses the state feedback control u=-K*X;let us the choose the
%disired closed loop poles at
  s=-2+j*4;  s=-2-j*4;   s=-10;
%we make this choice because we know from rom experience that such a set
%of closed loop poles will result in a reaonable or acceptable transient
%response.
%detemine the state feedback gain matrix K
syms k1 k2 k3 s
K=[k1 k2 k3];
z=s*eye(size(A))-A+B*K;
z=det(z);
%compare with  s=-2+j*4;  s=-2-j*4;   s=-10; we can obtain K
%the second method is to use Ackermanns formula
K=([0 0 1])*inv([B A*B A^2*B])*(A^3+14*A^2+60*A+200*eye(size(A)));
%K is a compromise between the rapidity of the response of the error
%vector and the sensitivity to disturbances and messurement noises.

%(6-4)slving pole placement problems with matlab
%pole placment problems can be solved easily with matlab which has two
%commands acker and place for the computation of the feedback gain matrix
%K.the command acker is based on ackermanns formula and applies to single
%input system only.
%if the system involves multiple inputs then for a specified set of closed
%loop poles the state feedback gain matrix K is not unique and we have an
%additional freedom to choose K,,,for example one common use is to
%maximize the stability margin.the pole placement based on this method is
%called robust pole placement.use place command
%howere place command requires the multiplicity of poles in the desired
%closed loop system be no grear than the rank of B
A=[0 1 0;
     0 0 1;
     -1 -5 -6;];
B=[0 0 1;].';
J=[-2+j*4 -2-j*4 -10];  %the J is the matrix consisting of the desired closed loop poles
K=acker(A,B,J);
%the command eig(A-B*K) may be used to verfy that K thus gives the desired
%eigenvalue
a=eig(A-B*K); %which must be same to J
KK=place(A,B,J); %LQR method

%(6-5)design of state observers with matlab
%in the pole placement approach to the design of control systems we
%assumed that all state variable for feedback;
%if an abserver that estimates fewer than n state variables,where n is the
%dimension of the state vector is called a reduced order state observer
%as we shall see later state observers can be designed if and only if the
%observability condition is satisfied. In many cases the observed,state
%vector Xx is used in the state feedback to genrate the desired control
%vetor,

%dXx=A*Xx+B*u+Ke*(y-C*Xx);
%de=(A-Ke*C)*e  where e=X-Xx;
%the problem of designing a full order observer becomes that of
%determining the observer gian matrix Ke such that the error dynamics
%difined  by equation de=(A-Ke*C)*e are asymptotically stable that with
%sufficient speed of response.
































































































































































回复
分享到:

使用道具 举报

 楼主| 发表于 2012-6-6 20:44 | 显示全部楼层
英语注解是我自己的。。。有点差,,
发表于 2012-6-24 15:16 | 显示全部楼层
ddddddddddddddddddddddddddddddd
发表于 2012-11-9 20:39 | 显示全部楼层
好 ,多谢
发表于 2013-1-6 10:41 | 显示全部楼层
如果注释换成中文就更好了
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-25 02:46 , Processed in 0.051831 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表