1 / 9

Introduction

Introduction. To this point MATLAB has been used to answer questions with a numeric value Variables are assigned specific values Answers are numbers MATLAB can also solve for symbolic answers Example: Solve a*x + b = 0 for x Answer: x = -b/a

psyche
Download Presentation

Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction • To this point MATLAB has been used to answer questions with a numeric value • Variables are assigned specific values • Answers are numbers • MATLAB can also solve for symbolic answers • Example: Solve a*x + b = 0 for x • Answer: x = -b/a • Exact answers can be given instead of numerically rounded results

  2. Warm-Up Problem Simplify this expression:

  3. Symbolic Math • The symbolic math toolbox can be used to solve many types of problems: • Simplifying complicated expressions • Solving algebraic equations symbolically • Factoring polynomials • Differentiation • Integration • Plotting • We will take a look at simplifying, solving, and factoring equations today.

  4. Simplifying • Lets go back to the warm-up problem: • Enter this into MATLAB: syms x s = (x^2*(x-6)+4*(3*x-2))((x+2)^2-8*x) • Notice the result is not indented in the command window • Let’s simplify this expression: simplify(s) • To generate this answer, MATLAB tries a bunch of different methods and returns the one with the fewest characters – not necessarily the prettiest one to look at

  5. Collect, Expand, Factor • These 3 operations are all performed by simplify • Collect(): Collects like terms of the symbolic variable (like x, x2, etc.) • Expand(): Uses polynomial multiplication and trig identities to expand expressions • Factor(): Takes a polynomial and determines the factors (opposite of expand) • Examples: • Try collecting terms in the warm-up problem • Expand sin(x-y) • Factor the result of the collect command in the first example

  6. Solve • The solve() command can solve a system of equations • If the # of equations is equal to the # of variables, then numerical answers are returned • If the # of equations is less than the # of variables, then a symbolic solution is returned, in terms of the symbolic variables Example: syms x y t S = 10*x+12*y+16*t; [xtyt] = solve(S, ‘5*x-y=13*t’) Could gaussian elimination be used to solve this system?

  7. Concept Questions • If you have 3 unknowns and 2 equations, how many solutions are there? • Are you guaranteed solutions?

  8. Group Problem • Two ellipses in the x-y plane have the following equations: Determine the coordinates of the points where the ellipses intersect. Plot the ellipses, and the intersection points

  9. For Next Time • Homework Due

More Related