Programming in MatLab and taking the following mathematical expression: ****Find
ID: 2320707 • Letter: P
Question
Programming in MatLab and taking the following mathematical expression:****Find the roots.****
x^5 + x + 1=0
Considerations:
• use: clear all, clc, disp, fprint, input, if-else, for, while, subprograms, vectors, matrix...
• do not use: roots, fzero, poly, polyval, residue, floor... Programming in MatLab and taking the following mathematical expression:
****Find the roots.****
x^5 + x + 1=0
Considerations:
• use: clear all, clc, disp, fprint, input, if-else, for, while, subprograms, vectors, matrix...
• do not use: roots, fzero, poly, polyval, residue, floor... Programming in MatLab and taking the following mathematical expression:
****Find the roots.****
x^5 + x + 1=0
Considerations:
• use: clear all, clc, disp, fprint, input, if-else, for, while, subprograms, vectors, matrix...
• do not use: roots, fzero, poly, polyval, residue, floor...
Explanation / Answer
f=@(x) x^5+x+1;
a=1;
b=2;
for i=1:100
c=(a+b)/2;
if f(c)>0
b=c;
else a=c;
end
end
a=1; b=2; p=c;
for i=1:100
c=(a+b)/2;
er(i)=f(c)-f(p);
if f(c)>0
b=c;
else a=c;
end
end
fprintf('Root of given equation is %f',c)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.