280 likes | 512 Views
Chapter 13: Solving Equations. MATLAB for Scientist and Engineers Using Symbolic Toolbox. You are going to. See that MuPAD solves algebraic equations and differential equations Plot the solution curve of the differential equations
E N D
Chapter 13:Solving Equations MATLAB for Scientist and Engineers Using Symbolic Toolbox
You are going to • See that MuPAD solves algebraic equations and differential equations • Plot the solution curve of the differential equations • Experience some chaotic systems described by a set of nonlinear differential equations.
Polynomial Equations • solvedoes it all Solution Target =0 is the default Not a simple closed form solution Numerical values
Set of Linear Equations • Under-determined equations • Verifying the solutions evalAt operator
Solving with Assumptions • Give some constraints on solutions
Exercise 1 • Compute the general solution of the system of linear equations How many free parameters does the solution have?
Infinite Number of Solutions • General Solutions • No Symbolic Solution? Try Numerical Solution.
Inequalities • Some Region is the Solution • Checking the Region
Differential Equations • ode and solve • 1st Order • 2nd Order
ODE with Initial Conditions • Initial Conditions with different Initial Values
Exercise 2 • Solve the following ODE for different values of a=-2, 0,+2 and plot the solutions.
Numerical ODE Solver • Original ODE Matrix Form • Matrix form ODE function • Numeric solution at t=1 initial value time duration
Plotting Numerical ODE Solution • plot::Ode2d • with Mapping function
Ode3d with 3D Mapping • plot::Ode3d
Chaotic System • Lorenz attractor Plot Generator Parameters of Lorenz attractor Initial Condition
Ode2d - Plot • Lorenz attractor (cont.) Initial points are nearly the same.
Ode3d • Lorenz attractor (cont.)
Numerical Solution at a Point • Lorenz attractor (cont.) Chaotic System
Exercise 3 • Compute the general solution y(x)of the differential equationy′ = y2/x . • Determine the solution y(x) for each of the following initial value problems:
Exercise 4 • Draw the 3-D trajectory of the solution of the following system of ordinary differential equations in x(t), y(t), z(t)assuming the initial conditions of x(0)=1, y(0)=0.1, z(0)=-1.
Difference Equations • Arithmetic Sequence
Difference Equations • General Solution • With Initial Conditions
Exercise 5 • The Fibonacci numbers are defined by the recurrence Fn = Fn−1 + Fn−2 with the initial values F0 = 0, F1 = 1. Use solve to find an explicit representation for Fn.
Key Takeaways • Now, you are able to • solve a set of linear and non-linear algebraic equations, • solve a set of ordinary differential equations, • solve a set of nonlinear differential equations numerically and plot them in 2D as well as in 3D space • and to solve difference equations.
Notes solve(x^2+x=y/4,x) solve({x+y+z=3,x+y=2,x-y-z=1},{x,y,z}) solve(sin(x)=1/2) solve( x^2 < 1, x ) plot::Curve2d(..) solve(ode(y''(t)=-3*y'(t)-2*y(t)+2*t^2, y(t))) plot::Ode2d(..) numeric::odesolve(f, 0..1,Y0) ode({y'(x)=y(x),y(0)=1}, y(x)) plot::Ode3d(..) eqn := rec(y(n+2)=y(n+1)+2*y(n), y(n))