Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TASK 1 : ( 8 - 1 2 min ) Main Script - Obtain and validate a user input for a coefficient vector Prompt the

TASK 1:(8-12min)
Main Script - Obtain and validate a user input for a coefficient vector
Prompt the user to enter a vector that contains the coefficients for a,polynomial.
Perform data validation to check that the user-entered vector contains an even number of elements
& HINT: Explore the rem() or mod() functions to help you. What is the remainder of an even number after dividing by 2? What is the remainder of an odd number after dividing by 2?
Continue re-prompting the user to re-enter the vector until a valid entry is obtained. Limit the total number of tries to 5 attempts.
If after the 5th attempt, an invalid vector is still entered, display a warning, and remove the last entry so that you have an even number of elements in the vector:
Example: Invalid =[12345] Valid =[1234]
Save the final vector as MA3_Polynomial.csy
TASK 2: (5-10min)
Main Script - Obtain and validate a user input for the root value initial guess; obtain a percent error value
Review the help documentation for the polyval() and polyder() functions. Practice in the command window to make sure you understand how each of these functions works and what the outputs mean! This is essential for the rest of the MA!
Prompt the user to input an initial guess for V0Vv is the x-value at which the user-entered polynomial function entered in Task 1 crosses the x-axis.
Perform data validation to check that the derivative of the polynomial does not equal zero at the user-entered x value. You are checking that T'(V0)0). Continue prompting the user to re-enter an initial guess until a valid entry is obtained. Limit the total number of tries to 3 attempts.
diamond HINT: You will need to use polyval() and polyder()
After three failed attempts to enter an x-value where the derivative does not equal zero, issue an error and terminate the program.
If a valid x-value is obtained, prompt the user to enter a percent error that will be used for the Newton-Raphson calculation. No additional validation on the percent error is required.
TASK 3: (15-25min)
Function - Calculate the true x-value where the function crosses the x-axis using the Newton-Raphson method Create a new function named FindZero,m
diamond Inputs: (3) Final vector of coefficients from Task 1, initial guess for Va from Task 2, percent error from Task 2 as a whole number.
diamond Outputs (2) Final value for V6 and number of iterations for the Newton-Raphson method
Within your function, repeatedly apply the Newton-Raphson method until the percent error between two subsequent iterations is less than the user-entered percent error.
Hint! polyval() and polyder() are very useful here!
Percent Diff ?a=bs(Output-PreviousOutputPreviousOutput)*100
If at any time the denominator in the Newton-Raphson calculation is equal to 0(i.e,f'(guess)=0), issue an error and terminate the program.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Will we be able to keep up with company growth?

Answered: 1 week ago

Question

The length of the curve y = In sec X from x = 0 to x = b, where 0

Answered: 1 week ago

Question

What is Selenium? What are the advantages of Selenium?

Answered: 1 week ago

Question

Explain the various collection policies in receivables management.

Answered: 1 week ago

Question

What are the main objectives of Inventory ?

Answered: 1 week ago