Presentation is loading. Please wait.

Presentation is loading. Please wait.

MatLab Programming By Kishan Kathiriya.

Similar presentations


Presentation on theme: "MatLab Programming By Kishan Kathiriya."— Presentation transcript:

1 MatLab Programming By Kishan Kathiriya

2 Table of Content History Classification Compilers Applications
Program Structure Data Types and Objects Sequence Control Input and Output Sub-Program Control Encapsulation and Inheritance Examples

3 Why MatLab? A proprietary programming language developed by MathWorks, Which is used to, Matrix manipulations Plotting of functions and data Implementation of algorithms Creation of user interfaces Interfacing with programs written in other languages, including C, C++, C#, Java, Fortran

4 History In 1970s, Cleve Moler, the Chairman of the Computer Science department at the University of New Mexico, Started developing MATLAB In 1984, recognizing its commercial potential, Jack Little, joined with Moler and Steve Bangert and rewrote MatLab in C and founded MathWorks company to continue its development In 2000, MatLab was rewritten to use a newer set of libraries for matrix manipulation, LAPACK It is now used in education, in particular the teaching of linear algebra, numerical analysis, and is popular amongst scientists involved in image processing. Very First version came out in June 2004 Total 29 versions till date with lots of updates The Latest version the released was in March 2017 which is version 9.2

5 Classification Classifications are Not Applicable to MatLab Programming

6 Compilers MatLab uses its own MatLab Compiler
This MATLAB Compiler convert MATLAB programs to applications and libraries that you can distribute to end users who do not have MATLAB installed. Can compile M-files, MEX-files, or other MatLab code Using MATLAB Compiler version before 3 you can generate: Standalone C and C++ applications on UNIX, Windows, and Macintosh platforms. C and C++ shared libraries (dynamically linked libraries, or DLLs, on Microsoft Windows).

7 Applications Main four Industries where MatLab is used most:
Aerospace industry- Hardware-in-loop simulations, mathematical modeling, embedded system-in-loop simulation Automobile industry - Vehicle networking, simulations, vehicle-in-loop simulation Computational science - biological data mining Embedded system Besides that. It is also used to do Machine learning Data analysis Image processing Signal processing, Face detection Radar and communication at a wide area

8 Program Structure

9 Program Structure

10 Program Structure

11 Program Structure

12 Program Structure

13 Data type and Objects Integer:
Int8/uint8 – 8 bit signed/unsigned integer value Int16/uint16 – 16 bit signed/unsigned Integer Value Int32/uint32 – 32 bit signed/unsigned Integer Value Int64/uint64 – 64 bit signed/unsigned Integer Value Single/double: Single/ double precision numerical data Logical: Logical values of 1 or 0, represent true and false respectively Char: Character data (strings are stored as vector of characters)

14 Data type and Objects Cell array:
Array of indexed cells, each capable of storing an array of a different dimension and data type Structure: C-like structures, each structure having named fields capable of storing an array of a different dimension and data type Function Handle: Pointer to a function User classes: Objects constructed from a user-defined class Java classes: Objects constructed from a Java class

15 Data type and Objects Operators:
Arithmetic Operators: +, - , *, /, ^, % Relational Operators: ==, !=, <, >, <=, >= Logical Operators: |, & Bitwise Operators : <<, >> Set Operators: intersect, union Operations: Matrix arithmetic operations: Matrix Addition, Multiplication, Subtraction Array arithmetic operations: same like basic operations but with array Set Operations: Operations done with set of values

16 Arithmatic Operations

17 Matrix in MatLab Matrix is also Supported Data Structure by MatLab
Just like if the input is: a = [ ; ; ; ] Output will be like:

18 Arithmatic Operations with Matrix

19 Data type and Objects Type Conversion in MatLab
char Convert to character array (string) int2str Convert integer data to string mat2str Convert matrix to string num2str Convert number to string str2double Convert string to double-precision value str2num Convert string to number native2unicode Convert numeric bytes to Unicode characters unicode2native Convert Unicode characters to numeric bytes base2dec Convert base N number string to decimal number And many more...

20 Sequence Control if ... end statement:
An if ... end statement consists of a boolean expression followed by one or more statements. if...else...end statement: An if statement can be followed by an optional else statement, which executes when the boolean expression is false. If... elseif...elseif...else...end statements: An if statement can be followed by one (or more) optional elseif... and an else statement, which is very useful to test various conditions. nested if statements: You can use one if or elseif statement inside another if or elseif statement(s). switch statement: A switch statement allows a variable to be tested for equality against a list of values. Nested switch statement: You can use one switch statement inside another switch statement(s).

21 Sequence Control Nested If Else Loop:

22 Sequence Control Nested Switch Statement:

23 Sequence Control For Loop: While Loop:

24 Continue Statement: Continue Statement:

25 Input and Output Input file : .mlx or .m file & Output: windows of the matlab software If Output is data: Command Window If graph or plot: Figure window

26 Sub-Program Control MatLab supports functions be like:

27 Encapsulation and Inheritance
Encapsulation and Inheritance are Not Applicable to MatLab Programming

28 Examples: MatLab is widely used for: Plotting Graphics Algebra
Calculus Differential Integration Polynomials Transforms Laplace Transforms Fourier Transforms

29 Plotting:

30 Graphics:

31 Algebra:

32 Algebra:

33 Algebra:

34 Calculating Limits: For example, let us calculate the limit of a function f(x) = (x3 + 5)/(x4 + 7), as x tends to zero.

35 Calculating Limits:

36 Differential:

37 Derivatives:

38 Integration:

39 Polynomials:

40 Polynomials:

41 Thank You!


Download ppt "MatLab Programming By Kishan Kathiriya."

Similar presentations


Ads by Google