CHAPTER 5

image

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 eq1,. . .,eqn (in the variables x1,. . ., xn).
  • syms x1 x2 ... xn; solve(eq1,eq2,...,eqn,x1,x2,...,xn) solves n simultaneous equations eq1,...,eqn (in the variables x1,..., xn).
  • 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.