MATLAB code for Routh-Hurwitz stability calculation;
![Command Window New to MATLAB? See resources for Getting Started 乓>> %% Routh-Hurwitz stability criterion Wo Na The Routh-Hurw](//img.homeworklib.com/questions/ae5bd280-b521-11eb-b9ef-17e4fabd2ea4.png?x-oss-process=image/resize,w_560)
![Command Window New to MATLAB? See resources for end end for j = 1: rhTableColumn - 1 lrst element of upper row firstElemUpper](//img.homeworklib.com/questions/af135320-b521-11eb-8e48-c3c232a0856c.png?x-oss-process=image/resize,w_560)
Answers;
2.
![Command Window New to MATLAB? See resources for Gettin input vector of your system coefficients: i.e. [an an-1 an-2... a0][1](//img.homeworklib.com/questions/b0350960-b521-11eb-bc28-5d78170fda0e.png?x-oss-process=image/resize,w_560)
3.![Command Window New to MATLAB? See resources for Getting Started. input vector of your system coefficients: 1.e. [an an-1 an-2](//img.homeworklib.com/questions/b0b77980-b521-11eb-a129-e74b91f921dd.png?x-oss-process=image/resize,w_560)
Command Window New to MATLAB? See resources for Getting Started 乓>> %% Routh-Hurwitz stability criterion Wo Na The Routh-Hurwitz stability criterion is a necessary (and frequently % sufficient) method to e3tablish the stability of a single-input , % single-output (SISO), linear time invariant (LTI) control system. % More generally, given a polynomial, 30me calculations using only the % coefficients of that polynomial can lead us to the conclusion that it is not stable. t Instructions % in this program you must give your system coefficients and the % Routh-Hurwitz table would be 3hown Farzad Sagharchi ,Iran 2007/11/12 % Initialization clear close all: clc % Taking coefficients vector and organizing the first two rows coeffvector = input (' input vector of your system coefficients: \n i.e. [an an-1 an-2 ceoffLength = length (coeffVector); rhTableColumn = round (ceoffLength/2); % Initialize Routh-Hurwitz table with empty zero array rhTable = zeros (ceoffLength, rhTableColumn); a0] '); = Compute first row of the table rhTable (1, coeftvector (1,1:2:ceoffLength) Check if length of coefficients vector is even or odd if (rem (ceoffLength, 2) 0) if odd, second row of table will be rhTable (2,1:rhTableColumn 1) -coeffVector (1,2:2:ceoffLength) else % if even, second row f table will be rhTable (2,:-coeffVector (1,2:2:ceoffLength) end Calculate Routh-Hurwitz table's rows % set epss as a small value epss = 0.01; % Calculate other elements of the table for i = 3:ceoffLength % special case : row of all zeros if rhTable (i-1,:) =-0 order = (ceoffLength- 1); cnt1 = 0;
Command Window New to MATLAB? See resources for end end for j = 1: rhTableColumn - 1 lrst element of upper row firstElemUpperRowrhTable (1-1,1) compute each element of the table rhTable (1,j) ((rhTable (1-1, 1) * rhTable (1-2,j+1)) = -.... (rhTable (i-2,1) rhTable (i-1,j+1))) / firstElemUpperRow:; end special case: zero in the first column rhTable (1,1) if =-0 rhTable (i,1)epsS: end end %% Compute number of right hand side poles (unstable poles) Initialize unstable poles with zero unstablePoles = 0; Check change in signs for i1:ceoffLength 1 if sign (rhTable (i,1)) sign (rhTable (i+1,1)) unstablePoles-unstablePoles + 1 end end % Print calculated data on screen fprintf 'n Routh-Hurwitz Table:1n') rhTable rint the stability result on screen if unstablePoles0 fprintf(> it is a stable system! <n' else end
Command Window New to MATLAB? See resources for Getting Started. input vector of your system coefficients: i.e. [an an-1 an-2 a0] = [1 8 29 61 72 45] Routh-Hurwitz Table: 21.3750 66.3750 36.1579 45.0000 39.7729 45.0000 1.0000 29.0000 72.0000 8.0000 61.0000 45.0000 0 0 0 0 0 0 it is a stable system!< Number of right hand side poles 0 Do you want roots of system be shown? Y/N y Given polynomial coefficients roots: sysRoots -3.0000 0.00001 -1 . 5000 + 1 . 6583i -1.5000-1.65831 -1.0000 1.4142i -1.0000-1.41421
Command Window New to MATLAB? See resources for Gettin input vector of your system coefficients: i.e. [an an-1 an-2... a0][1 8 25 37 16-5] Routh-Hurwitz Table: rhTable .0000 25.0000 16.0000 8.0000 37.0000-5.0000 0 0 20.3750 16.6250 30.4724 -5.0000 19.9682 5.0000 0 w*** it is an unstable system!< Number of right hand side poles 1 Do you want roots of system be shown? Y/N Y Given polynomial coefficients roots: sys Roots = -3.4102 0.00001 -1.7954 1.6678i -1.7954 - 1.6678i -1.2020 0.00001 0.2031 0.0000i fx >>
Command Window New to MATLAB? See resources for Getting Started. input vector of your system coefficients: 1.e. [an an-1 an-2 a0][1 6 18 60 89 54 721 Routh-Hurwitz Table: rhTable 1.0000 18.0000 89.0000 72.0000 6.0000 60.0000 54.0000 8.0000 80.0000 72.0000 0.0100 0 0 80.0000 72.0000 -0.0090 72.0000 0 0 0 0 > it is an unstable system! Number of right hand side poles = 2 Do you want roots of system be shown? Y/N Y Given polynomial coefficients roots sysRoots -4.00000.00001 -0.00003.0000i -0.0000-3.00001 -2.0000 0.0000 -0.0000 1.0000i -0.00001.00001