MatLab Programming By Kishan Kathiriya.

Slides:



Advertisements
Similar presentations
Introduction to Computers and Programming Lecture 7:
Advertisements

Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
Elementary Data Types Scalar Data Types Numerical Data Types Other
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
Introduction to FORTRAN
1 CSC103: Introduction to Computer and Programming Lecture No 2.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
Eng Ship Structures 1 Introduction to Matlab.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
Lecture 1 - Introduction June 3, 2002 CVEN 302. Lecture’s Goals General Introduction to CVEN Computer Applications in Engineering and Construction.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Introduction to Computer Programming Using C Session 23 - Review.
1. Exam Topics Difference between computers and calculators John creates a new device. It will compute the orbit of all the planets in the solar system.
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and.
Chapter 1: Brief Overview of MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
Java Programming, Second Edition Chapter Two Using Data Within a Program.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Expressions and Control Flow. Expressions An expression is a combination of values, variables, operators, and functions that results in a value y = 3(abs(2x)
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
1 Chapter 1: Basic Concepts Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine 9/6/2003.
Chapter 3 Data Representation
Basic Concepts: computer, program, programming …
Matlab.
EEE 161 Applied Electromagnetics
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
“Under the hood”: Angry Birds Maze
Introduction to Matlab
L – Modeling and Simulating Social Systems with MATLAB
Software for scientific calculations
Object Oriented Programming
Introduction to MATLAB
Test Review Computer Science History
Welcome to MATLAB.
Other Kinds of Arrays Chapter 11
Other Kinds of Arrays Chapter 11
Introduction Mathcad is a product of mathSoft inc. The Mathcad can help us to calculate, graph, and communicate technical ideas. It lets us work with.
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
MATLAB(Matrix Laboratory). Introduction Developed by MathWorks Numerical Computing Environment Fourth-generation Programming Language.
Invitation to Computer Science, Java Version, Third Edition
INTRODUCTION TO BASIC MATLAB
INTRODUCTION c is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs.
Computer Science I CSC 135.
Introduction to Programming
Matlab review Matlab is a numerical analysis system
Use of Mathematics using Technology (Maltlab)
An Introduction to Java – Part I, language basics
Unit I C Language Review Ref. Book: Yashavant Kanetkar, “Let Us C”, BPB Publications, 10/E, 2010.
Communication and Coding Theory Lab(CS491)
High Level Programming Languages
Differences between Java and C
SELECTIONS STATEMENTS
Comp Org & Assembly Lang
Understand the interaction between computer hardware and software
Matlab Basic Dr. Imtiaz Hussain
JavaScript CS 4640 Programming Languages for Web Applications
Unit 3: Variables in Java
DATA TYPES There are four basic data types associated with variables:
C Language B. DHIVYA 17PCA140 II MCA.
Review of Java Fundamentals
COS 151 Bootcamp – Week 4 Department of Computer Science
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

MatLab Programming By Kishan Kathiriya

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

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

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

Classification Classifications are Not Applicable to MatLab Programming

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).

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

Program Structure

Program Structure

Program Structure

Program Structure

Program Structure

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)

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

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

Arithmatic Operations

Matrix in MatLab Matrix is also Supported Data Structure by MatLab Just like if the input is: a = [ 1 2 3 4 5; 2 3 4 5 6; 3 4 5 6 7; 4 5 6 7 8] Output will be like:

Arithmatic Operations with Matrix

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...

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).

Sequence Control Nested If Else Loop:

Sequence Control Nested Switch Statement:

Sequence Control For Loop: While Loop:

Continue Statement: Continue Statement:

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

Sub-Program Control MatLab supports functions be like:

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

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

Plotting:

Graphics:

Algebra:

Algebra:

Algebra:

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

Calculating Limits:

Differential:

Derivatives:

Integration:

Polynomials:

Polynomials:

Thank You!