Computer Programming (MATLAB) : Sudhanwa Kulkarni / Dr. Samir Kale
Computer Programming (MATLAB) : Sudhanwa Kulkarni / Dr. Samir Kale
https://t.me/MATLAB_S2_2020
This group will be strictly used for Course related issues,
difficulty solving purposes only.
MATLAB Basics
MATLAB Environment: Various Windows and their use
Operators
Basic Matrix Operations
MATLAB Environment
asin( )
Inverse Trigonometric
acos( ) asin(0.7071) = 0.7854
Functions
atan( )
9 BITS Pilani, Deemed to be University under Section 3, UGC Act
Operators
abs(2) = 2
abs(z) ABSOLUTE VALUE of “z”
abs(-3) = 3
Lab Session 01
I.Optimization Problems
II. Roots of non-linear equations
Optimization
Optimization is determining the best solution out of all possible
solutions for the problem by satisfying restrictions/limitations to it.
IMPORTANT NOTE
Objective function should be minimization while
following this approach. If it is a maximization
function then convert it in to a minimization
function by multiplying objective function by -1.
Automatic by
Selection of Solver By User
MATLAB
Subject to
X12 + X22 <= 5
2X1 – 2X2 = 1
Lab Session 01
Roots of non-linear equations
Writing Non Linear
Equations in MATLAB
To following write polynomial equation in MATLAB
x3 + 2x2 - 4x + 3 [1 2 -4 3]
x3 + 2x2 + 3 x3 + 2x2 + 0x + 3 [1 2 0 3]
x5 + 2x2 + 3 x5+0x4+0x3+2x2+0x+3 [1 0 0 2 0 3]
>> p = [1 2 -4 3]
>> roots(p)
Instead of range [4 1], just one initial guess can be given like
>> fzero(‘2*x-log10(x)-7’ , 4)
ans =
3.7893
32 BITS Pilani, Deemed to be University under Section 3, UGC Act