S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan Math Review with Matlab: Fundamentals Symbolic Math Toolbox.

Slides:



Advertisements
Similar presentations
Multidimensional Array
Advertisements

FUNCTIONS Section 3.1.
Beginning Programming for Engineers
Complex Numbers S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Math Review with Matlab: Complex Math.
Solving Algebraic Equations
Calculus S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Math Review with Matlab: Differentiation.
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Differential Equations Math Review with Matlab: Finding Solutions to Differential Equations S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department.
CSE 123 Symbolic Processing. Declaring Symbolic Variables and Constants To enable symbolic processing, the variables and constants involved must first.
Programming Environment S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Cells and Structures.
MATLAB FUNDAMENTALS: USER DEFINED FUNCTIONS THE SYMBOLIC TOOLBOX HP 100 – MATLAB Wednesday, 10/29/2014
Calculus S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan-Dearborn Math Review with Matlab: Limits.
ES 314 Lecture 2 Sep 1 Summary of lecture 1: course overview intro to matlab sections of Chapters 2 and 3.
Lecture 16 Symbolic Mathematics Symbolic mathematics: algebraezplotcalculus © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Numerical Operations S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Numerical Integration.
Programming Environment S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Introduction to Matlab: Control Flow.
Math Review with Matlab: Application: Solving Differential Equations
Matlab Matlab is a powerful mathematical tool and this tutorial is intended to be an introduction to some of the functions that you might find useful.
Chapter 11 Additional Intrinsic Data Types Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul.
Solving Algebraic Equations S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan-Dearborn Math Review with Matlab:
S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan Math Review with Matlab: Simplification Symbolic Math Toolbox.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn Laplace Transform Math Review with Matlab: Calculating the Laplace.
MATH – High School Common Core Vs Kansas Standards.
Using Java's Math & Scanner class. Java's Mathematical functions (methods) (1)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide P- 1.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
January 24, 2005 Lecture 3 - By P. Lin 1 CPET 190 Lecture 3 Problem Solving with MATLAB
Copyright © 2011 Pearson, Inc. P.1 Real Numbers. Copyright © 2011 Pearson, Inc. Slide P What you’ll learn about Representing Real Numbers Order.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
6.5 – Solving Equations with Quadratic Techniques.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (2): MATLAB Environment (Chapter 1)
Unit P: Prerequisite P.1 Real Numbers P.2 Exponents and Radicals P.3 Polynomials and Factoring P.4 Rational Expressions P.5 Solving Equations P.6 Solving.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Chapter 12 Review: Symbolic Mathematics
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
Chapter 2: First Steps in MuPAD MATLAB for Scientist and Engineers Using Symbolic Toolbox.
1 MatLab Basics Jae Hoon Kim Department of Physics Kangwon National University It contains hundreds of commands to do mathematics. Graph functions, solve.
Introduction To this point MATLAB has been used to answer questions with a numeric value ▫Variables are assigned specific values ▫Answers are numbers MATLAB.
Integer numerical data types. The integer data types The integer data types use the binary number system as encoding method There are a number of different.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Introduction to Matlab
Digital Image Processing Lecture4: Fundamentals. Digital Image Representation An image can be defined as a two- dimensional function, f(x,y), where x.
Engineering Analysis – Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
P.1P.1 Real Numbers. Quick Review Quick Review Solutions.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley P.1 Real Numbers.
Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Matlab Data types, input and output. Data types Char: >> a = ‘ Jim ’ Char: >> a = ‘ Jim ’ Numeric: uint8, uint16, uint32, uint64 int8, int16, int32, int64.
Matlab Basic. MATLAB Product Family 2 3 Entering & Quitting MATLAB To enter MATLAB double click on the MATLAB icon. To Leave MATLAB Simply type quit.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
CMPS 1371 Introduction to Computing for Engineers CHARACTER STRINGS.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Interduction to MATLAB (part 2) Manal Alotaibi Mathematics department College of science King saud university.
BASICS OF MATLAB Engr.Mian Shahzad Iqbal Lecturer,Telecom Department University of Engineering & Technology Taxila.
ECE 1304 Introduction to Electrical and Computer Engineering
Other Kinds of Arrays Chapter 11
Other Kinds of Arrays Chapter 11
Fundamentals & Ethics of Information Systems IS 201
An Introduction to Maple
Symbolic mathematics: algebra ezplot calculus
4 Laws of Integral Indices
Introduction to MATLAB
Storing Integers and Fractions
Introduction to Matlab:
Presentation transcript:

S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan Math Review with Matlab: Fundamentals Symbolic Math Toolbox

Symbolic Toolbox:Fundamentals 2 Fundamentals of Matlab’s Symbolic Toolbox n Creating Symbolic Variables Creating Symbolic Variables n Defining Symbolic Expressions Defining Symbolic Expressions n Defining Numerical Representation Defining Numerical Representation n Converting Symbolic Variables to Doubles Converting Symbolic Variables to Doubles n Creating Real Symbolic Variables Creating Real Symbolic Variables n Creating Complex Symbolic Variables Creating Complex Symbolic Variables n Manipulating Abstract Functions Manipulating Abstract Functions

Symbolic Toolbox:Fundamentals 3 Defining Symbolic Variables Use sym to create a symbolic variable x: » x=sym('x'); Use syms to create several symbolic variables at one time Use who to view al variables in the workspace » who Your variables are: a b x y » syms y a b

Symbolic Toolbox:Fundamentals 4 Use whos to view all workspace variables with their associated size, bytes, and class information Viewing Workspace Variables » n=1.0;t=[ ]; » whos Name Size Bytes Class a 1x1 126 sym object b 1x1 126 sym object n 1x1 8 double array t 1x3 24 double array x 1x1 126 sym object y 1x1 126 sym object Grand total is 12 elements using 536 bytes

Symbolic Toolbox:Fundamentals 5 Symbolic Expressions n Symbolic Expressions: Symbolic and Numerical Conversions to perform a mathematical operation and create a new symbolic variable delta: » f = 2*x^2 + x + 1; » g = a*x^2 + b*x + 5 g = a*x^2+b*x+5 » delta = sym('1+sqrt(2)/2'); » f = delta^2 + delta; f = (1+1/2*2^(1/2))^2+1+1/2*2^(1/2)

Symbolic Toolbox:Fundamentals 6 The command sym(A,flag) converts a numeric scalar or matrix, A, to symbolic form The flag argument specifies the technique for converting floating point numbers Numerical Representation 'f' Exactly represents Floating Point values in the form '1.F'*2^(e) or '-1.F'*2^(e) where F is a string of 13 hexadecimal digits and e is an integer. (This form may not be convenient for subsequent manipulation) 'd' Represents Decimal numbers where the number of digits is taken from the current setting of DIGITS (described later)

Symbolic Toolbox:Fundamentals 7 » rho=(1+sqrt(5)/2) » rho_float = sym(rho,'f') rho_float = '1.0f1bbcdcbfa54'*2^(1) » rho_decimal = sym(rho,'d') rho_decimal = Symbolic Representation Example Symbolic Variables rho = Double-Precision Floating Point Variable

Symbolic Toolbox:Fundamentals 8 digits, by itself, displays the current accuracy (default = 32 digits) Digits Command The digits command is used to set the number of digits of accuracy used for future numeric computations on symbolic variables digits(n) sets accuracy to n digits for subsequent calculations. Where n represents an integer

Symbolic Toolbox:Fundamentals 9 Digits Example » digits Digits = 32 » rho=(1+sqrt(5)/2); » rho_decimal = sym(rho,'d') Default Precision (32 Digits) Adjusted Precision (7 Digits) » digits(7) » rho_decimal_7=sym(rho,'d') rho_decimal_7 = rho_decimal =

Symbolic Toolbox:Fundamentals 10 » x=sym(3);y=sym(4); » z_sym = x/y z_sym = 3/4 » z_float = double(z_sym) z_float = Double Command The double command coverts a symbolic variable to a general Matlab double floating point number Symbolic Variable Double Float Variable

Symbolic Toolbox:Fundamentals 11 Declaring Real Variables n To declare real symbolic variables: n Or use shorthand notation: » x = sym('x','real'); » y = sym('y','real'); » syms x y real » who Your variables are: x y

Symbolic Toolbox:Fundamentals 12 Declaring Complex Variables To construct a complex number use i or j to represent the imaginary part Use real to find the real part » syms x y » z=x+i*y; % or z=x+j*y z= x+i*y Use imag to find the imaginary part » z_real = real(z) z_real = x » z_imag = imag(z) z_imag = y

Symbolic Toolbox:Fundamentals 13 Unreal The 'unreal' argument to sym can be used to convert a real variable to a purely formal variable with no additional properties » x=sym('x','real'); » conj(x) ans = x If x is real, the complex conjugate of x will be x If x is unreal, the complex conjugate of can not be further simplified » x=sym('x','unreal'); » conj(x) ans = conj(x)

Symbolic Toolbox:Fundamentals 14 n Abstract functions are useful for solving algebraic and differential equations Abstract Functions A symbolic variable can represent an abstract function: f=sym('f(x)') where the input argument is a string » f=sym('2*x+2') f = 2*x+2

Symbolic Toolbox:Fundamentals 15 Abstract Function Example n Find the determinant and inverse of the matrix z: » syms a b c » z=[ a 0 0; 0 b 0; 0 0 c] z = [ a, 0, 0] [ 0, b, 0] [ 0, 0, c] » determinant = det(z) determinant = a*b*c » inverse = inv(z) inverse = [ 1/a, 0, 0] [ 0, 1/b, 0] [ 0, 0, 1/c]

Symbolic Toolbox:Fundamentals 16 Matrix Manipulation Example n Change the first element of the matrix from a to g: » z(1,1)='g' z = [ g, 0, 0] [ 0, b, 0] [ 0, 0, c]

Symbolic Toolbox:Fundamentals 17 Summary n Matlab can be used to create and manipulate symbolic variables and expressions n Symbolic variables representing numbers can be displayed with adjustable accuracy n Symbolic variables can be declared as real, complex, or converted to the default unreal state n Abstract functions can be created and manipulated symbolically The double command converts symbolic variables into Matlab double precision floating point variables