Matlab_Numerics - MATLAB Numerical Basics Roots of...

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

View Full Document Right Arrow Icon
MATLAB Numerical Basics
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
( 29 0 12 17 3 = + - = x x x p >> roots( [ 1 0 -17 12 ] ) ans = -4.4389 3.7102 0.7286
Background image of page 3

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

View Full DocumentRight Arrow Icon
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.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online