logo

MATLAB Assignment: Stability Analysis of Linear Differential Equations

   

Added on  2023-04-08

15 Pages1847 Words118 Views
MATLAB Assignment 1
MATLAB ASSIGNMENT
Name
Course Code
Professor
University
City and State
Date

MATLAB Assignment 2
Task 2.1 and 3.2
Introduction
Solution of linear differential equation is important in any engineering applications
especially in the design phases. The Hurwitz matrix method is an important technique in the
solution of linear differential equation with constant coefficients. Using the Hurwitz matrix, we
are able to establish the stability of any closed-loop system. However, we must first find the
characteristic equation of the linear differential equation to be able to determine the Hurwitz
matrix. Routh’s stability criterion is used to answer the question of stability of a system without
necessarily solving for the roots of the characteristic equation. It only determines the number of
closed loop poles that fall in the RHS of the s-plane (Li, 2011).
The necessary conditions for the Hurwitz matrix method is that the solutions of the
characteristic equation must have real parts that are smaller than zero in a strict sense. Therefore,
all the coefficients of the characteristic equations must be non-zero and all positive or all
negative without any sign changes. The principal minors of the formed Hurwitz matrix H can be
used to deduce for stability in that all solutions of the characteristic equation have real parts that
are smaller than zero strictly if and only if the principal minors of the Hurwitz matrix are all
positive in a strict sense (Nise, 2015).
To determine the stability of the system using Routh-Hurwitz method, the polynomial
(characteristic equation) must be checked to have all non-zero elements, and that all coefficients
have the same sign. Using the HurwitzMatrix() and IsStable() functions created in MATLAB,
the stability of the system is then successfully determined by checking for sign changes in the
first column of Hurwitz matrix, H (McMahon, 2011).

MATLAB Assignment 3
Methodology
MATLAB functions were used to obtain Hurwitz matrix and comment on the stability of
the closed-loop system given the characteristic equation. The characteristic equation must be a
row vector representing the polynomial (HAHN, 2019).
The AllNonZero() function was used to check that all the elements of the row vector
consumed were non-zeros. AllNonZero() returns a value 0 (False) whenever at least one zero
coefficient of the polynomial is detected. It returns 1(True) if all the coefficients of the
polynomial are non-zero elements.
The AllSameSign() function consumes the row vector polynomial of the characteristic
equation and check that all the elements of the row vector have the same sign. It returns a value
1(True) if all the coefficients of the polynomial have the same sign and 0(False) when the signs
of all the coefficients are not the same.
The HurwitzMatrix() function takes the row vector and returns the Hurwitz matrix
associated with the polynomial. For a valid output, the two conditional functions AllNonZero()
and AllSameSign() must be 1(True).
Finally to assess the stability of the closed-loop system using Routh-Hurwitz matrix
method, a function IsStable() was created. It checks that the conditions above are met and then
calculates the Hurwitz matrix. All the principal minors are checked to be positive in a while loop
and stops checking when a negative or zero principal minor is encountered. A comment on the
stability of the system is then made successfully (McMahon, 2011).

MATLAB Assignment 4
Task 2.1
The MATLAB functions
1. AllNonZero() function
function y = AllNonZero(x)
%ALLNONZERO returns a value 0(false) if at least one of the
coefficients of
%the polynomial is zero and a value 1(True) otherwise.
n = nnz(x);
if isrow(x)==0
disp('The entry made is not a row vector')
else if numel(x)==n
disp('1(True)')
else
disp('0(False)')
end
end
2. AllSameSign() function
function y = AllSameSign(x)
%ALLSAMESIGN takes a row vector representing a polynomial and
returns a
%value 0(false) if not all the coefficients have the same sign
and a value
%1(True) otherwise.
s=sign(x);m=(s<0);q=(s>0);
if isrow(x)==0
disp('The entry made is not a row vector')
else if nnz(m)==numel(s)||nnz(q)==numel(s)
disp('1(True)')
else
disp('0(False)')
end
end
3. HurwitzMatrix() function
function y = HurwitzMatrix(x)
%Hurwitz Matrix formulation
leng=length(x);
modulo=mod(leng,2);
if modulo==0
u=rand(1,(leng/2));
v=rand(1,(leng/2));
for i=1:(leng/2)

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Linear Systems and Control
|9
|525
|147

Computer Aided Analysis Report
|10
|1589
|14

MEEM 5715 : Linear Systems
|8
|665
|30

Linear Algebra, Calculus and Probability Theory Solutions
|12
|1439
|328

Math Assignment Invertible Matrix Theorem
|5
|413
|350

University Affiliation Assignment
|12
|1530
|71