Question

In: Advanced Math

In matlab ask the user to select whether to repeat the Newton-Raphson calculation or end the...

In matlab ask the user to select whether to repeat the Newton-Raphson calculation or end the program. If the user exits out of the menu, repeat the request until the user makes a selection. If the program is repeated, store the new final value of the root and new number of iterations in the same variables without overwriting the previous results. Once the user chooses to end the program, save the variables containing the root values and numbers of iterations as calculation res.mat

this is my code so far

vector = input("Enter a vector which has an even number of elements: ");

the vector you enter is the polynomial you work with

the vector that is entered is [0.2 0.3 0 2.4 9.8 -21.4]

Solutions

Expert Solution


hat is the initial guess? 2
Would you like to continue y/n ? y
What is the initial guess? 4
Would you like to continue y/n ? y
What is the initial guess? 5
Would you like to continue y/n ? y
What is the initial guess? 7
Would you like to continue y/n ? y
What is the initial guess? 9
Would you like to continue y/n ? y
What is the initial guess? 11
Would you like to continue y/n ? y
What is the initial guess? 13
Would you like to continue y/n ? y
What is the initial guess? n
Would you like to continue y/n ?
       root    iteration
           8.0000000000001                       500
          7.99999999999999                       500
                         8                         5
                         8                         4
                         8                         4
                         8                         5
                         8                         5
                         8                       500


Related Solutions

Implement in MATLAB the Newton-Raphson method to find the roots of the following functions. (a) f(x)...
Implement in MATLAB the Newton-Raphson method to find the roots of the following functions. (a) f(x) = x 3 + 3x 2 – 5x + 2 (b) f(x) = x2 – exp(0.5x) Define these functions and their derivatives using the @ symbol. For example, the function of part (a) should be f=@(x)x^3 + 3*x.^2 - 5*x + 2, and its derivative should be f_prime=@(x)3*x.^2 + 6*x - 5. For each function, use three initial values for x (choose between -10...
Write a mips assembly language program. Ask the user whether he wants to repeat the program:...
Write a mips assembly language program. Ask the user whether he wants to repeat the program: "\nRepeat [y/n]? ". Use service code 12 to read a character and the branch instruction to repeat the main function if the user input is character 'y'.
USE MATLAB Write a program in Matlab that would continuously ask the user for an input...
USE MATLAB Write a program in Matlab that would continuously ask the user for an input between 1 and 6, which would represent the result of rolling a die. The program would then generate a random integer between 1 and 6 and compare its value to the value entered by user. If the user’s die is larger, it should display, “Mahahanap mo na ang forever mo. Sana all!” If the user’s die is smaller, it should display, “Gising na friend,...
Implement the working of a mohr circle in matlab. ask user to enter the stresses in...
Implement the working of a mohr circle in matlab. ask user to enter the stresses in x and y direction. take the inputs to a stress tensor. then use formulations to find the eigen value and vectors. MATLAB
Using Matlab, create a code that determines the highest real root of f(x)=x3-6x2+11x-6.1 using the Newton-Raphson...
Using Matlab, create a code that determines the highest real root of f(x)=x3-6x2+11x-6.1 using the Newton-Raphson method with x0=3.5 for three iterations. Verify that the process is quadratically convergent. I found the code to get the highest real root (root for three iterations = 3.0473), however, I do not know how to verify that it is quadratically convergent.
In MatLab 1. Ask the user to enter a 1 x 5 vector of numbers. Determine...
In MatLab 1. Ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. 2. Ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. If the user enters a 5 x 1 vector, use a warning statement to inform the user of their error, and set the new input value to be the transpose of the user input value. If the user...
python: ask the user to input a sequence of positive numbers. the end of the sequence...
python: ask the user to input a sequence of positive numbers. the end of the sequence is determined when the user enters a negative number. print out the maximum number from the sequence. output: keep entering positive numbers. to quit, input a negative number. enter a number: 67 enter a number: 5 enter a number: 8 enter a number: -3 largest number entered: 67 (note: i do not want to ask the user how many numbers they will input)
Create a matlab program that calculates equivalent cpacitance and charge by asking the user whether the...
Create a matlab program that calculates equivalent cpacitance and charge by asking the user whether the circuit is in paraller , series or combination and then asks for the values of capacitances and voltage. After that it calculates the equivalent capacitance.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT