Computational-Economics-0902
question 1: Use the bisection method to solve the equation $x^3-2=0$. Please code the bisection algorithm by yourself.
1 | %matlab code: |
question 2: Use the bisection method to solve the equation $x^3-2=0$. Please apply the “bisect” function in CEtools to solve the question.
1 | %matlab code: |
question 3: Plot the whole iteration path in E1, using array x(i) to store the x value when the number of iteration is i
1 | %matlab code: |
question 4: Learn how to construct and call function in MATLAB. Let function [x,gval] = myfun(g,x,maxit,tol), gval = feval(g,x); Finally, call “myfun” within the same folder, to solve the equation $x=x^{0.5}$ with initial guess 0.4, max iteration number 100, and tolerance 1e-6.
1 | %matlab code: |