Question

Consider the following polynomial equation: ax3 bx2 cx d 0 Write a program that allows the user to enter the coefficients a,b

PLEASE USE MATLAB.

THANK YOU!

0 0
Add a comment Improve this question Transcribed image text
Answer #1


a=input('enter coefficient a: ');
b=input('enter coefficient b: ');
c=input('enter coefficient c: ');
d=input('enter coefficient d: ');
fn = @(x) a*x^3+b*x^2+c*x+d;
a=input('enter lower value of interval: ');
b=input('enter upper value of interval: ');
%to check if the solution exits in the given interval
an=fn(a)*fn(b);
if an>0
    fprintf('the root does not exit between given range');
else
    fprintf('the root lies between the interval and \n');
end
x1=a;
x2=b;
error=2;
while error>=0.01
    x0=(x1+x2)/2;
    an=fn(x0);
    error=abs(0-an);
    if fn(x0)<0
        x1=x0;
        x2=x2;
    else
        x1=x1;
        x2=x0;
    end
end
fprintf('the root is= %f\n',x0);

a) to check for solution in the range

Command Window >bisecc enter coefficient a: 2 enter coefficient b: 3 enter coefficient c: 4 enter coefficient d: 5 enter lowe

b) to check for condition if root does not lie in the range

> bisecc enter coefficient a: 2 enter coefficient b 3 enter coefficient c: 4 enter coefficient d: 5 enter lower value of inte

Add a comment
Know the answer?
Add Answer to:
PLEASE USE MATLAB. THANK YOU! Consider the following polynomial equation: ax3 bx2 cx d 0 Write a program that allows th...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Matlab script to complete the following: 1. Write a script file that allows a...

    Write a Matlab script to complete the following: 1. Write a script file that allows a user to: a. Plot a function from a list b. Change the function coefficients c. Choose function range and number of points d. Replot a new function on the same graph keeping the original function e. Replot a new function on the same graph overwriting the original function f. Save the graph (as a png file) Functions to choose from: y A sin(Bx +...

  • This is not a linear graph to just choose points and solve. Can you please use the ax3+bx2+cx+d=0...

    This is not a linear graph to just choose points and solve. Can you please use the ax3+bx2+cx+d=0 to find the slope here? 12 11.57 0.1714 10.650.1632 9.66 0.1544 8.7 0.1454 7.22 0.1308 5.79 0.1152 4.45 0.0953 3 2.894 0.0759 1.946 0.0606 1 0.979 0.04063 0 1.77 -0.0577 3.5-3.319-0.0824 4.31 -0.096 5.82 -0.1149 7.69-0.135 0.15 11 -0.1665 12 -11.610.171 10 Voltage vs Current 7.5 6 4.5 0.0|66x + 0.0014 y R2 0.975 05 0 0.068 1.7 4.5 6 25 Voltage(V)...

  • In C please! Thank you! Write a program that finds the smallest (min), largest (max), and...

    In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...

  • Write MIPS code, please. Following: Write a program to be used by the Wisconsin DNR to...

    Write MIPS code, please. Following: Write a program to be used by the Wisconsin DNR to track the number of Deer Hunting Licenses issued in a county and the state. It will display a menu with 5 choices numbered 1-5. They are (1) update the count, (2) display the number of licenses already issued to a county whose number is input, (3) display the county number and the number of licenses already issued to a range of counties whose starting...

  • Use c-strings for the following project: Write a C++ program that declares an array containing up...

    Use c-strings for the following project: Write a C++ program that declares an array containing up to a maximum of 20 sentences, each sentence of maximum 81 characters long, using c-strings. Continue reading sentences from the user and store them in the array of sentences, until the user enters a NULL string for the sentence or 20 sentences have been entered. Then, one by one, display each sentence entered by the user and present the following menu of operations on...

  • The polynomial addition C function of Program 2.6 padd is the code when the polynomial is used to...

    The polynomial addition C function of Program 2.6 padd is the code when the polynomial is used to arrange the polynomial in the two arrangement methods of the polynomial described in the text 2.4.2. For the remaining method, when the expression polynomial is arranged by a coefficient, create a polynomial addition C function padd() corresponding to Program 2.6. 66 Arrays And Structures are zero are not displayed. The term with exponent equal to zero does not shouw able since x...

  • ***PLEASE AVOID USING A "CLASS" IN SOLUTION*** thank you. Please use Visual Studio to write a...

    ***PLEASE AVOID USING A "CLASS" IN SOLUTION*** thank you. Please use Visual Studio to write a C# program to allow user to store contact information. 1. User should be able to type in name, E-mail and phone number in the text boxes and click Add button to save the contact record. Every time when user add record, user should be able to see all the information displayed in the right side display text box. (allow up to 10 records) 2....

  • Please use C programming to write the code to solve the following problem. Also, please use the i...

    Please use C programming to write the code to solve the following problem. Also, please use the instructions, functions, syntax and any other required part of the problem. Thanks in advance. Use these functions below especially: void inputStringFromUser(char *prompt, char *s, int arraySize); void songNameDuplicate(char *songName); void songNameFound(char *songName); void songNameNotFound(char *songName); void songNameDeleted(char *songName); void artistFound(char *artist); void artistNotFound(char *artist); void printMusicLibraryEmpty(void); void printMusicLibraryTitle(void); const int MAX_LENGTH = 1024; You will write a program that maintains information about your...

  • Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program...

    Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program is required that allows a user to encode text using any of three possible ciphers. The three ciphers you are to offer are: Caesar, Playfair and Columnar Transposition. • The program needs to loop, repeating to ask the user if they wish to play with Caesar, Playfair or Columnar Transposition until the user wishes to stop the program. •For encoding, the program needs to...

  • You have been asked to write a program to grade several multiple-choice exams. The exam has...

    You have been asked to write a program to grade several multiple-choice exams. The exam has 20 questions, each answered with a letter in the range of ‘a’ through ‘f’. The answers key is declared in the program as constant of type string. An example of answer key is “abcdefabcdefabcdefab”. Your program should work for any other answer key. The program should first ask users for the number of students to be graded. Then it should have a while loop...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT