1. Math
  2. Advanced Math
  3. need help writting this code out...

Question: need help writting this code out...

Question details

Project 2 - Falsepos Phys 333 This project is to find the roots of a function using your LASTNAME falsepos.m function. Your function is the polynomial from class: fx)- -12 -21x 18x2-2.75x Make an external function file LASTNAME poly.m that receives as inputs the x value to be evaluated, as well as the coefficients a, b, c, and d, and returns the f(x). Use your function LASTNAME falsepos.m to calculate the roots. There are several roots, so you will need to repeat the call for each root. Use the bisect routine to check your answer. (You dont need to turn in bisect.) Submit both files (LASTNAME_poly.m and LASTNAME_falsepos.m and your script). The starting place to calculate the roots by calling your function is the Project2start.m script in the Project2 folder. Submit your script. (Be sure to change all the LASTNAME in the file names to your actual last name!) Publish and print out your results to hand in. I am looking for the value of the roots, and the number of iteration using falsepos, and the number of iterations using bisect. I included as an example page one from my script. (You need to include the other pages that have the numbers!) You need to submit to Canvas: 1. (function) LASTNAME_poly.m 2. (function) LASTNAME falsepos.nm 3. (script) LASTNAME _Project2.m You need to hand in: Published results document that shows the location of each root and the number of iterations it took to find it for both falsepos and bisect. 4.

Project 2 - LASTNAME Root Finding This is the starting place for project 2. First, create the external function file and call it polyLASTNAME Next, you will need to modify this script and submit it with your function. Call the function and plot it to see where the crossings are x-linspace(1,5) a-12: b--21; C-18; d-2.75: y-pol yHAKES (x, a, b, c , d) ; plot (x, y) 30 20 15 10 .10 15 -20 The first root is somewhere between -1 and 0. (Try the bisect routine to check your answer.) Solve using your routine falseposLASTNAME. The inputs and outputs should be IDENTICAL to those for bisect. use: es-stopping error-.0001 maxiter-rnaximum number of iterations = 100 also dont forget to sent in the a,b,c.d, since your function will need them. We will repeat this three times for the three roots. Root 1 xl- lower x value guess 1 xu-upper x value guess 0

% Project 2 - LASTNAME Root Finding This is the starting place tor project 2. First, create the external function file and call it polyLASTNAME . Next yu will need to modify this script and submit it with your function. Call the function and plot it to see where the crossings are x=1 inspace (-1, 5) ; a12; b--21 с 18 ; d--2.75 Y-polyLASTNAME (x, a,b,c,d); plot (x,Y) The first root is somewhere between -1 and 0. % (Try the bisect routine to check your answer.) % solve using your routine falseposLASTNAME. The inputs and outputs % should be IDENTICAL to those for bisect % use: es - stopping error = .0001 maxiter maximum number of iterations 00 % also dont forget to sent in the a,b,c,d, since your function wil1 need & them. % we will repeat this three times for the three roots. %Root 1 x1 lower x value guess -1 xu upper x value guess0 [rooti,fx1,eal,iteri) -Your stuff goes here! !! pause % Root 2 xi - lower x value guess 2 xu upper x value guess 3 %Your stuff goes here ! ! ! = [root2, fx2, ea2, iter2] pause 응응 %Root 3 xi - lower x value guess 4

media%2F516%2F5161a3c7-eb8a-4e47-9858-aa


need help writting this code out.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution