Added check for the correct number of variables and added a few comments

This commit is contained in:
2018-09-22 16:19:44 -04:00
parent 3b669a2979
commit 3f00730c9f
6 changed files with 60 additions and 13 deletions

View File

@@ -1,13 +1,20 @@
function [xList,errorList] = Bisection (f, lowerValue, upperValue, allowError)
function [xList,errorList] = Bisection(f, lowerValue, upperValue, allowError)
%
%Bisection(f, lowerValue, upperValue, allowError)
%Uses the bisection method to find the possible answers to the root of the function f
%
pkg load symbolic;
warning('off','OctSymPy:sym:rationalapprox');
%Setting necesary values for the function
cnt = 1;
%Check that the number of input variables is correct
if(nargin ~= 4)
error('That is not the correct number of arguments')
end
%A few necesary things before we begin
pkg load symbolic;
warning('off','OctSymPy:sym:rationalapprox');
%Constant Variables
maxItterations = 50;
%Variables
cnt = 1;
errorValue = 1;
currentValue = 0.0;