SlideShare a Scribd company logo
1 of 1
Download to read offline
Please write a MATLAB code to find the roots of the function by using Bisection method
(Hint: Try with initial guess of 1 and 3.)
Please show the steps and codes, thank you !
Solution
f=@(x) x^6-3*x^3+2.25;
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)

More Related Content

More from ajaycosmeticslg

Please write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfPlease write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdf
ajaycosmeticslg
 

More from ajaycosmeticslg (13)

Please write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdfPlease write in C++ and should be able to compile and debug.Thank yo.pdf
Please write in C++ and should be able to compile and debug.Thank yo.pdf
 
Please verify if the statement is true or false (I had to submit to .pdf
Please verify if the statement is true or false (I had to submit to .pdfPlease verify if the statement is true or false (I had to submit to .pdf
Please verify if the statement is true or false (I had to submit to .pdf
 
Please write clearly 6. Briefly define the terms Linear, Homogeneous.pdf
Please write clearly 6. Briefly define the terms Linear, Homogeneous.pdfPlease write clearly 6. Briefly define the terms Linear, Homogeneous.pdf
Please write clearly 6. Briefly define the terms Linear, Homogeneous.pdf
 
please use datailThe New York State Health Department reports a 1.pdf
please use datailThe New York State Health Department reports a 1.pdfplease use datailThe New York State Health Department reports a 1.pdf
please use datailThe New York State Health Department reports a 1.pdf
 
Please use Best BuySolutionRoe = Annual net income Sharehold.pdf
Please use Best BuySolutionRoe = Annual net income  Sharehold.pdfPlease use Best BuySolutionRoe = Annual net income  Sharehold.pdf
Please use Best BuySolutionRoe = Annual net income Sharehold.pdf
 
Please solve the following and show all work! Thanks! Let and .pdf
Please solve the following and show all work! Thanks! Let  and  .pdfPlease solve the following and show all work! Thanks! Let  and  .pdf
Please solve the following and show all work! Thanks! Let and .pdf
 
Please tell me the definition of polynomial function and when it is .pdf
Please tell me the definition of polynomial function and when it is .pdfPlease tell me the definition of polynomial function and when it is .pdf
Please tell me the definition of polynomial function and when it is .pdf
 
Please think of an employment occupation that utilizes theoretical p.pdf
Please think of an employment occupation that utilizes theoretical p.pdfPlease think of an employment occupation that utilizes theoretical p.pdf
Please think of an employment occupation that utilizes theoretical p.pdf
 
Please show your workStructural analysis 2. Trusses are only stati.pdf
Please show your workStructural analysis 2. Trusses are only stati.pdfPlease show your workStructural analysis 2. Trusses are only stati.pdf
Please show your workStructural analysis 2. Trusses are only stati.pdf
 
Please solve and explain 1. You toss a coin 270 times. Find the.pdf
Please solve and explain 1. You toss a coin 270 times. Find the.pdfPlease solve and explain 1. You toss a coin 270 times. Find the.pdf
Please solve and explain 1. You toss a coin 270 times. Find the.pdf
 
Please solve problem. Thanks.Suppose that you toss a coin and .pdf
Please solve problem. Thanks.Suppose that you toss a coin and .pdfPlease solve problem. Thanks.Suppose that you toss a coin and .pdf
Please solve problem. Thanks.Suppose that you toss a coin and .pdf
 
Please show your working. A particle executes an unrestricted .pdf
Please show your working. A particle executes an unrestricted .pdfPlease show your working. A particle executes an unrestricted .pdf
Please show your working. A particle executes an unrestricted .pdf
 
Please solve problem. Thanks.In how many ways can a chairperso.pdf
Please solve problem. Thanks.In how many ways can a chairperso.pdfPlease solve problem. Thanks.In how many ways can a chairperso.pdf
Please solve problem. Thanks.In how many ways can a chairperso.pdf
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

Please write a MATLAB code to find the roots of the function by usin.pdf

  • 1. Please write a MATLAB code to find the roots of the function by using Bisection method (Hint: Try with initial guess of 1 and 3.) Please show the steps and codes, thank you ! Solution f=@(x) x^6-3*x^3+2.25; 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)