Matlab_Numerics

# Matlab_Numerics - MATLAB Numerical Basics Roots of...

This preview shows pages 1–5. Sign up to view the full content.

MATLAB Numerical Basics

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Roots of Polynomials MATLAB can find all roots (both real and imaginary) of polynomials. 1 1 2 1 ) ( + - + + + + = n n n n a x a x a x a x p Store coefficients in a vector v = [ a 1 a 2 … a n a n+1 ]. Use roots builtin function with vector as argument. Return value is a vector containing all n roots of the polynomial
( 29 0 12 17 3 = + - = x x x p >> roots( [ 1 0 -17 12 ] ) ans = -4.4389 3.7102 0.7286

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Roots of Functions MATLAB can find a single root for any function for which a MATLAB function file can be written. One of the builtin methods for doing this is fzero. fzero( @fname , approx_root ) fname is the name of the function for which a root is to be located. It can have only one argument, the function’s variable. approx_root is an initial guess for the value of the root. Caution: Some authors use ‘inline’ functions in examples. Get used to writing m-file functions for use with numerical solvers. Inline functions are very limiting. Do not use them.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/08/2009 for the course CHE 210 taught by Professor Swinnea during the Fall '08 term at University of Texas.

### Page1 / 10

Matlab_Numerics - MATLAB Numerical Basics Roots of...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online