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.

Slides:



Advertisements
Similar presentations
Chapter 0 Review of Algebra.
Advertisements

LAPLACE TRANSFORMS.
4.5 Complex Numbers Objectives:
1 Eng. Mohamed El-Taher Eng. Ahmed Ibrahim. 2 1.FUNCTION SUMMARY polyfun  Polynomial functions are located in the MATLAB polyfun directory. For a complete.
H(s) x(t)y(t) 8.b Laplace Transform: Y(s)=X(s) H(s) The Laplace transform can be used in the solution of ordinary linear differential equations. Let’s.
CSE 123 Symbolic Processing. Declaring Symbolic Variables and Constants To enable symbolic processing, the variables and constants involved must first.
Lecture 16 Symbolic Mathematics Symbolic mathematics: algebraezplotcalculus © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Lecture 141 EEE 302 Electrical Networks II Dr. Keith E. Holbert Summer 2001.
Solving Linear Equations Rule 7 ‑ 1: We can perform any mathematical operation on one side of an equation, provided we perform the same operation on the.
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
Lect11EEE 2021 Inverse Laplace Transformations Dr. Holbert February 27, 2008.
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.
Matrix Mathematics in MATLAB and Excel
Copyright © Cengage Learning. All rights reserved. 7.6 The Inverse of a Square Matrix.
1. Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rational Exponents, Radicals, and Complex Numbers CHAPTER 10.1Radical.
Chapter 1 Number Sense See page 8 for the vocabulary and key concepts of this chapter.
Sistem Kontrol I Kuliah II : Transformasi Laplace Imron Rosyadi, ST 1.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Rational Exponents, Radicals, and Complex Numbers
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Copyright 2013, 2009, 2005, 2002 Pearson, Education, Inc.
Copyright © 2007 Pearson Education, Inc. Slide 7-1.
LIAL HORNSBY SCHNEIDER
Copyright © Cengage Learning. All rights reserved. 4 Quadratic Functions.
Partial-fraction Expansion
ECE 4115 Control Systems Lab 1 Spring 2005
1 Inverse Laplace Transform Note that most of the transforms are written as fractions.
Rational Transforms Consider the problem of finding the inverse Laplace transform for: where {ai} and {bi} are real numbers, and M and N are positive.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
Section 5.7: Additional Techniques of Integration Practice HW from Stewart Textbook (not to hand in) p. 404 # 1-5 odd, 9-27 odd.
Chapter 2 Laplace Transform 2.1 Introduction The Laplace transform method can be used for solving linear differential equations. Laplace transforms can.
Chapter 8 Integration Techniques. 8.1 Integration by Parts.
MM150 Unit 3 Seminar Agenda Seminar Topics Order of Operations Linear Equations in One Variable Formulas Applications of Linear Equations.
Integrating Rational Functions by Partial Fractions Objective: To make a difficult/impossible integration problem easier.
THE LAPLACE TRANSFORM LEARNING GOALS Definition
4.5 Matrices, Determinants, Inverseres -Identity matrices -Inverse matrix (intro) -An application -Finding inverse matrices (by hand) -Finding inverse.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
Chapter 7 The Laplace Transform
Chapter P Prerequisites: Fundamental Concepts of Algebra 1 Copyright © 2014, 2010, 2007 Pearson Education, Inc. 1 P.7 Equations.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Section 7.4 Integration of Rational Functions by Partial Fractions.
SOLVING ONE-STEP EQUATIONS Integrated Math I Objective: Solve one-step linear equations in one variable with strategies involving inverse operations and.
Class 3 Linear System Solution Using the Laplace Transform
Using Matrices to Solve a 3-Variable System
EEE 244-3: MATRICES AND EQUATION SOLVING
Trigonometric Identities
LAPLACE TRANSFORMS.
Lec 4. the inverse Laplace Transform
(2) Region of Convergence ( ROC )
MTH1170 Integration by Partial Fractions
SIGMA INSTITUTE OF ENGINEERING
Exponents and Radicals
DIFFERENTIATION & INTEGRATION
Complex Frequency and Laplace Transform
Lecture 3: Solving Diff Eqs with the Laplace Transform
Chapter 5 Integral Transforms and Complex Variable Functions
Symbolic mathematics: algebra ezplot calculus
Trigonometric Identities
Substitution, Elimination, Graphing, Matrices
Chapter 7: Matrices and Systems of Equations and Inequalities
Introduction to MATLAB
Matrices.
EEE 244-3: MATRICES AND EQUATION SOLVING
THE LAPLACE TRANSFORM LEARNING GOALS Definition
Presentation transcript:

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.

Simple computations are very easy. Just type in exactly what you want computed and press enter. If no variables are used, the answer will automatically be assigned to the variable ans.

This variable can be used later, but don't forget that it will automatically be overwritten when a new computation is done.

Variables are also easy to use. Simply type a variable name, the equal sign, and then some value to be assigned.

At any time, you can type "whos" at the command line to see what variables have been assigned.

Other common mathematical functions are available such as square root, trigonometric functions, exponential functions, etc. Refer to the help window under the help menu for the syntax of these functions. Most of the common mathematical functions are listed in the file matlab/elfun.

Calculus

To perform symbolic differentiation or integration, you must first declare a symbolic variable. This is done by typing "syms x" where x is the variable name. In the following example, x is declared as symbolic and then used to find the indefinite integral and derivative of a function.

The definite integral can also be computed by adding the lower and upper bounds, separated by commas, after the function to integrate. (Note that a function of a valid symbol is still required)

MATLAB Complex Numbers

The variable i is already defined as the square root of -1. We can verify this by calculating i * i.

Arithmetic with imaginary numbers is very straightforward.

The functions abs and angle allow us to convert the complex number from rectangular to polar form.

Angle returns the phase angle in radians, but converting to degrees we see that the answer is what we expected.

MATRICES

Matrices are the basis of Matlab, so manipulating them is very simple. First, you input matrices by placing the values in brackets, with semicolons separating the rows.

Matrices of the same dimensions can be added and subtracted, and conformable matrices can be multiplied.

Finding the determinant or the inverse of a matrix is also simple.

These functions are particularly useful in circuit analysis, where it is necessary to solve several simultaneous equations. For example, if analysis yielded the equations: 7v1 - 4v2 - 2v3 = 3 -4v1 + 9v2 - 2v3 = 0 -2v1 - 2v2 + 5v3 = -12

It would be very easy to solve for the unknowns. First, create a 3x3 matrix with the coefficients of v1, v2, and v3, then create a 1x3 matrix with the right hand side of the equations. Finally, multiply the inverse of the first matrix with the second matrix, and the resulting matrix contains the answers.

This method also will work with symbolic variables. For example, you can solve for equations when using a Laplace transform by declaring s as a symbol ("syms s") and then entering the values into the matrix.

Sometimes the way the answers are given is somewhat confusing. The answers to the last example are: i1 = (s² + 3s + 4) / [(s+3)(s3 + 8s² + 11s + 20)] i2 = 2s / [(s+3)(s3 + 8s² + 11s + 20)]

MATLAB POLYNOMIALS & RATIONAL FUNCTIONS

Matlab also provides tools for manipulating polynomials and rational functions. To use these tools, the polynomial should be represented as a vector with the leftmost number being the highest power and the rightmost number being the constant. For example, x² + 2x + 1 would be represented as [1 2 1]. The roots function gives the roots of the polynomial and polyval evaluates the polynomial at the given value. Multiplying and dividing polynomials can be done with conv and deconv

To multiply x² + 2x + 1 and x + 1, we use

Note that deconv will return two vectors, the first contains the coefficients for the quotient polynomial, and the second contains the coefficients for the remainder polynomial. The following example divides x3 + 3x² + 3x + 2 by x + 1 If the left hand side of the equation didn't contain two variables, the answer would only have the quotient and the remainder would be discarded.

Matlab also has a function that will give the partial fraction decomposition of a rational function. This is very useful when working with Laplace transforms. The function residue takes two polynomials and returns the residues, the poles, and the direct term (quotient).

The partial fraction expansion of (2s + 5) / (s3 + 5s² + 8s + 4) is found by

There is a pole at –1 and a repeated pole at –2. There is no direct term since the order of the numerator was less than the order of the denominator. (2s + 5) / (s3 + 5s² + 8s + 4) = -3 / (s + 2) -1 / (s + 2)² + 3 / (s + 1)