# Mathematics

Introduction

1. There are various Math functions in MATLAB: exp, sqrt, log, etc.
2. Various statistics functions in MATLAB are: mean, max, min, std, etc.
3. MATLAB also offers lots of Trigonometric functions e.g., sin, cos, tan, etc.
4. Complex numbers are important in modelling and control theory which is defined as; z = a + ib or z = a + jb where imaginary unit (i/j) is i=√-1.
5. MATLAB represents polynomials as row arrays containing coefficients ordered by descending powers.

Simple Math Function

Creates a function that calculates the following mathematical exp.
z=3x^2+√(x^2+y^2) +ln(x)

Test with different values of x and y.

Statistics

1. MATLAB has built-in functions for many statistics.
2. min and max functions also return the index of the smallest or largest value.
3. If there is more than one occurrence, it returns the first.
4. For matrices, the min and max functions operate columnwise by default.

5. The arithmetic mean of a data set is what is usually called the average of the values.
6. For a matrix, the mean function operates columnwise.
7. To find the mean of each row, the dimension of 2 is passed as the second argument to the function

8. Harmonic Mean: It is calculated by using harmmean function.
9. Geometric Mean: It is calculated by using geomean function.

10. Variance and standard deviation are ways of determining the spread of the data.
11. The built-in function to calculate the variance is called var.
12. The standard deviation can be found either as the sqrt of the variance or using std.

13. The mode of a data set is the value that appears most frequently.
14. The built-in function in MATLAB for this is called mode.

15. The median is defined only for a data set that has been sorted first, meaning that the values are in order.
16. The function in MATLAB is called median.

Set Operations

1. These include union, intersect, unique, setdiff, and setxor.
2. All of these functions can be useful when working with data sets.

3. The function ismember receives two vectors as input arguments, and returns a logical vector that is the same length as the first argument.
4. Contains logical 1 for true if the element in the first vector is alsoin the second, or logical 0 for false if not.

5. The issorted function will return logical 1 for true if the argument is sorted in ascending order (lowest to highest), or logical 0 for false if not.

Trigonometric Functions

Create various trigonometric functions and plot them on same figure.

Complex Numbers

Complex no. is defined as:
z = a + ib or z = a + jb
The complex conjugate of z is defined as:
z* = a – ib

Polynomials

It is expressed as:
p(x)=p1x^n+p2x^(n-1)+—+pn+pn+1
where p1,p2,p3,… are the coefficients of polynomial.
Polynomial,
p(x)=-5.45x^4+3.2x^2+8x+5.6 will be written as shown.

MATLAB Functions