Professional Documents
Culture Documents
Lab 04
Lab 04
To practice developing of Programs, finding solution of ODE, Polynomial roots and Partial
Fractions.
It is easy to learn, versatile and very useful for engineers and other professionals. MATLAB is a
special-purpose language that is an excellent choice for writing moderate-size programs that solve
problems involving the manipulation of numbers. The design of the language makes it possible to
write a powerful program in a few lines. The problems may be relatively complex, while the
MATLAB programs that solve them are relatively simple: relative that is, to the equivalent
program written in a general-purpose language, such as C++ or Java. As a result, MATLAB is
being used in a wide variety of domains from the natural sciences, through all disciplines of
engineering, to finance, and beyond, and it is heavily used in industry. Hence, a solid background
in MATLAB is an indispensable skill in today’s job market.
Applications of MATLAB
Else-if statement
A "For" Loop is used to repeat a specific block of code a known number of times. For example,
if we want to check the grade of every student in the class, we loop from 1 to that number. When
the number of times is not known before hand, we use a "While" loop.
While loop
While loop is also known as a pre-tested loop. In general, a while loop allows a part of the code to
be executed multiple times depending upon a given Boolean condition. It can be viewed as a
repeating if statement. The while loop is mostly used in the case where the number of iterations is
not known in advance.
Applications
a) Classical mechanics:
b) Electrodynamics:
c) General relativity
d) Quantum mechanics:
e) Cooling/Warming law
f) Population Growth and Decay
g) Radio-active Decay and Carbon Dating
3.0. Polynomials
The word “Polynomial” is originated from 2 word – “Poly” and “Nomial”. Poly means “many”,
nominal refer to “terms”. The meaning of polynomial is associated expression that has several
terms. It is defined as a single term or a sum of the finite number of the term. Polynomial can be
operated for addition, subtraction, multiplication, and non-negative number exponents.
Polynomials seem during a wide range of areas of arithmetic and science.
A polynomial is a finite expression constructed from variables and constants, using the operations
of addition, subtraction, multiplication, and taking non-negative integer powers. A polynomial can
be written as the sum of a finite number of terms.
For example; 8x + 7 = 5.
Where,
x = variable
Vectors B and A specify the coefficients of the numerator and denominator polynomials in
descending powers of s. The residues are returned in the column vector R, the pole locations in
column vector P, and the direct terms in row vector K. The number of poles is n = length(A)-1 =
length(R) = length(P). The direct term coefficient vector is empty if length(B) < length(A),
otherwise length(K) = length(B)-length(A)+1.
4.0. Exercise
Solution