Computational Method Course CHEG 220: Week - 2 - Lec - 2 Programming With MATLAB
Computational Method Course CHEG 220: Week - 2 - Lec - 2 Programming With MATLAB
CHEG 220
Week_2_Lec_2
Programming with MATLAB
Previously
in CHEG220
Mathematical description of an
engineering problem
Construction of numerical
algorithms
Programming
Outline
instructions,
conditional
It is a method for creating structured programs. Its purpose is to describe the aim
of a program at a very high level initially and then partition it into more detailed
levels until the program structure become enough understood to be coded.
The process of top-down design consists of the following steps:
Define the problem mathematically
Specify the input
Specify the output
Use a simpler set of data to work out the solution steps by hand
Write a program
Run it
Compare the solution with your hand solution
Run the program with your input data
Main Program
Input A,B
Output X
X=A-1*B
Matrix Inverse
give A
get A-1
Matrix Determinant
give A
get det (A)
Matrix Product
give A-1 and B
get X
Example 4 : (The relational operators have equal precedence among themselves. They
are evaluated in order from left to right )
z = 5>3 ~= 1
z = (5>3) ~= 1
z=0
Questions
In three words, define a well written MATLAB program