You are on page 1of 32

Applied Mathematics IV

MATH - 422

Course Concern: Owais Ali


Department of Mathematics, University of Sindh
Books Recommended

 Getting Started with MATLAB by Rudra Paratab.


 Numerical Methods in Engineering with MATLAB by Jaan
Kiusalaas.
 Computer Programming with MATLAB J. Michael
Fitzpatrick and Ákos Lédeczi.

2
Contents
MATLAB as a Calculator
Arithmetic Operators in MATLAB

 Binary arithmetic operators in MATLAB are:


 + for addition
 − for subtraction
 ∗ for multiplication
 / for division
 ^ for exponentiation
5
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

3+𝑥 3+𝑥

6
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

3𝑥 3∗𝑥

7
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

3𝑥 + 4 3∗𝑥+4

8
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

−2𝑥 + 8𝑦 −2 ∗ 𝑥 + 8 ∗ y

9
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax


𝑥 𝑥/𝑦
𝑦

10
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax


𝑥+𝑦 (𝑥 + y)/2
2

11
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax


3𝑥 (3 ∗ 𝑥)/(4 ∗ 𝑦)
4𝑦

12
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

𝑥 2 + 3𝑥 + 4 𝑥^2 + 3 ∗ 𝑥 + 4

13
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax


2𝑎𝑠 (2 ∗ 𝑎 ∗ 𝑠)/(𝑠^2 + 𝑎^2)
𝑠 2 + 𝑎2

14
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

𝑒𝑥 exp(𝑥)

15
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

𝜋 𝑝𝑖

16
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

𝑒 2𝜋 exp(2 ∗ 𝑝𝑖)

17
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax


2 +4
𝑒 𝑥 exp(𝑥^2 + 4)

18
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

2 2^(1/2) or 𝑠𝑞𝑟𝑡(2)

19
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

𝑥+4 𝑠𝑞𝑟𝑡(𝑥 + 4)

20
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax

𝑒𝑥 𝑦 exp(𝑥 ∗ 𝑠𝑞𝑟𝑡 𝑥 + 4 )

21
Trigonometric and
Logarithmic Functions
Trigonometric Functions in MATLAB

 Syntax for trigonometric functions in MATLAB are as


follows:

Function MATLAB syntax

sin 𝑥 sin(𝑥)
cos 𝑥 cos(𝑥)
tan 𝑥 tan(𝑥)
23
Trigonometric Functions in MATLAB

 Note that all the before mentioned trigonometric


functions in MATLAB take arguments as radians by default
and not as degree.

24
Trigonometric Functions in MATLAB

 For input in degrees, the functions in MATLAB are as


follows:

Function MATLAB syntax

sin 𝑥 sind(𝑥)
cos 𝑥 cosd(𝑥)
tan 𝑥 tand(𝑥)
25
Trigonometric Functions in MATLAB

 Inverse trigonometric functions in MATLAB are:

Function MATLAB syntax

sin−1 𝑥 asin(𝑥)
cos −1 𝑥 acos(𝑥)
tan−1 𝑥 atan(𝑥)
26
Trigonometric Functions in MATLAB

 Inverse trigonometric functions with output in degrees are:

Function MATLAB syntax

sin−1 𝑥 asind(𝑥)
cos −1 𝑥 acosd(𝑥)
tan−1 𝑥 atand(𝑥)
27
Logarithmic Function in MATLAB

 Syntax in logarithmic function in MATLAB is:

Function MATLAB syntax

log 𝑒 𝑥 or ln 𝑥 log(𝑥)
log10 𝑥 or log 𝑥 log10(𝑥)

28
MATLAB Syntax

 Try writing the following expression in MATLAB syntax:

Expression MATLAB syntax


2
𝑒 𝑥 cos−1 𝑥 sin 𝑥 (exp 𝑥^2 ∗ acos 𝑥 ∗ sin(𝑥))/ log10(𝑥)
log 𝑥

29
MATLAB Syntax

The equation 3𝑥 = 17 do not have any algebraic solution.


ln 17
The solution to the equation is 𝑥 = .
ln 3
Verify it with MATLAB.

30
MATLAB Syntax

Recall the Euler’s formula:


𝑒 𝑖𝜃 = cos 𝜃 + 𝑖 sin 𝜃
Take any value for 𝜃 and verify the Euler’s Formula.

31
End

You might also like