R=[6,-4;-4,14] % Resistance matrix. R = 6 -4 -4 14 V=[9;0], % Voltage vector. V = 9 0 I=inv(R)*V I = 1.8529 0.5294 A=[-4,-4;2,-4], % System matrix of RLC circuit. A = -4 -4 2 -4 B=[4;0], % Input matrix B = 4 0 C=[0,2], % Output matrix C = 0 2 ssRLC=ss(A,B,C,0), % State-space Representation of RLC circuit. a = x1 x2 x1 -4 -4 x2 2 -4 b = u1 x1 4 x2 0 c = x1 x2 y1 0 2 d = u1 y1 0 Continuous-time model. eA=eig(A) eA = -4.0000 + 2.8284i -4.0000 - 2.8284i step(ssRLC) tfRLC=tf(ssRLC) Transfer function: 16 -------------- s^2 + 8 s + 24 bode(ssRLC) grid % Plotting signals. t=0:0.01:5; % Time vector. who Your variables are: A C R eA t B I V ssRLC tfRLC s=sin(2*t); % Sinusoid with a frequency of 2 rad/sec. figure plot(t,s) e=exp(-0.5*t); figure plot(t,e) size(s) ans = 1 501 size(e) ans = 1 501 ds=s.*e; figure plot(t,ds) title('Damped Sinusoid') ylabel('Output Response') xlabel('Time (seconds)') figure(3) title('Exponential Decay') uiopen('Z:\mlab\340\demos\stp_fn.m',1) x=2*stp_fn(t)-2.5*stp_fn(t-1.5)+0.5*stp_fn(t-4); figure plot(t,x) axis([-1 6 -1 3]) help eig EIG Eigenvalues and eigenvectors. E = EIG(X) is a vector containing the eigenvalues of a square matrix X. [V,D] = EIG(X) produces a diagonal matrix D of eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that X*V = V*D. [V,D] = EIG(X,'nobalance') performs the computation with balancing disabled, which sometimes gives more accurate results for certain problems with unusual scaling. If X is symmetric, EIG(X,'nobalance') is ignored since X is already balanced. E = EIG(A,B) is a vector containing the generalized eigenvalues of square matrices A and B. [V,D] = EIG(A,B) produces a diagonal matrix D of generalized eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that A*V = B*V*D. EIG(A,B,'chol') is the same as EIG(A,B) for symmetric A and symmetric positive definite B. It computes the generalized eigenvalues of A and B using the Cholesky factorization of B. EIG(A,B,'qz') ignores the symmetry of A and B and uses the QZ algorithm. In general, the two algorithms return the same result, however using the QZ algorithm may be more stable for certain problems. The flag is ignored when A and B are not symmetric. See also condeig, eigs, ordeig. Overloaded functions or methods (ones with the same name in other directories) help lti/eig.m help sym/eig.m Reference page in Help browser doc eig edit xx=dummy(t); check=xx-t; plot(check) diary off