(an introduction to relative functions needed for N1040 Linear System) Prepared by Szu-Chi Tien I. Some useful functions for control Here Ill list some functions used in this course. Simulate LTI model response to arbitrary inputs [y,t,x] = lsim(A, B, C, D, u, t, x0); or [y,t,x] = lsim(sys,u,t,x0);
Rank of A RANK(A)
Sigular Value Decomposition of A [U,S,V] = SVD(A) Note: if A is a controllability matrix, the first q-column vectors in U-matrix corresponding to non-zero singular values can be used as the basis of controllable subspace; the rest column-vectors in U-matrix can be used as the basis of uncontrollable subspace. Moreover, these column vectors are orthornomal.
Find the Observability Matrix OBSV(A,C) II. Operation with symbolic tool box Using Matlab symbolic tool box allows users to do symbolic operations. To let Matlab recognize that users want to do symbolic operation instead numerical computation, some key-things should be addressed. 1. Its a good habit to use >> clear to clear all variable in the workspace before doing the symbolic operation. This will avoid messing up usual variables and symbolic variables. 2. Use >> syms to declare a symbolic variable that users want to use for symbolic operation. 3. Use >> whos to list declared symbolic variables. 4. Use >> help sym/function_name to find how to use a symbolic function. For instance, to know how to do differentiation, use help sym/diff 5. Some examples for useful functions are listed as follows
Partial Fraction find the partial fraction expression of s +1 b( s ) r1 r2 3 2 = = + +k = + ( s + 3)( s + 4) a ( s ) s p1 s p 2 s+4 s+3 b=[1 1];| a=[1 7 12]; [r,p,k] = residue(b,a);
1; 1
a_inv=inv(a); a_inv_simple=simple(a_inv);
1; 1
1/(s+1) ];
Differentiation clear, syms a b c x; f=exp(-a*x)*x^(3*b)*sin(c*x); diff_f = diff(f,x); diff_f_simple=simple(diff_f); %simplify the result