CHAPTER 5

Equations and Systems

MATLAB offers certain commands that allow you to solve equations and systems. Among them are the following:

- solve('equation','x')
**solves the equation in the variable**x**.** - syms x; solve(equ(x),x)
**solves the equation**equ(x)**in the variable**x**.** - solve('eq1,eq2,...,eqn','x1,x2,...,xn')
**solves**n**simultaneous equations**eq1eqn*,. . .,***(in the variables**x1xn*,. . .,***).** - syms x1 x2 ... xn; solve(eq1,eq2,...,eqn,x1,x2,...,xn)
**solves**n**simultaneous equations**eq1eqn*,...,***(in the variables**x1xn*,...,***).** - X = linsolve(A,B)
**solves**A * X = B**for a square matrix**A**, where**B**and**X**are matrices.** - x = nnls(A,b)
**solves**A * x = b**in the least-squares ...**

Get *MATLAB Symbolic Algebra and Calculus Tools* now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.