incsearch - brackets(i 2 = upper bound for ith bracket if...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [ brackets ] = incsearch ( f, min, max, points ) % INCSEARCH: locates roots by incremental search % Inputs: f = a function of one variable % (need not be able to deal with vectors) % min = lower bound of range to be searched % max = upper bound of range to be searched % points = number of search steps % Outputs: brackets(i, 1) = lower bound for ith bracket
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % brackets(i, 2) = upper bound for ith bracket % **** if no brackets found, brackets = **** % nb = 0; brackets = ; x = linspace (min, max, points); flo = f(x(1)); for i = 2: points fhi = f(x(i)); if sign(flo) ~= sign(fhi) nb = nb + 1; brackets(nb, 1) = x(i - 1); brackets(nb, 2) = x(i); end flo = fhi; end; end e...
View Full Document

This note was uploaded on 10/18/2010 for the course SYSC 3600 taught by Professor Adsd during the Spring '10 term at Universidad Alfonso X El Sabio.

Ask a homework question - tutors are online