Question
Please Help with a MATLAB Code implementation. (PS: Actually, it's not 5 Questions, Please do answer and provide some details for me to understand, please
Please Help with a MATLAB Code implementation. (PS: Actually, it's not 5 Questions, Please do answer and provide some details for me to understand, please i beg )
Task: Use Matlab to realize the bisection method.
Requirements
- Learn the principle of the bisection method by yourself.
- Branches, loops, and user-defined functions should be included.
- Apply the bisection method to acquire the roots of and .
- The final outputs are the roots of the equations and the number of iterations. Also, the function curves should be plotted.
- The comment for each statement in your script is necessary.
- Hand in your report and all your M files.
- Principle: Write the principle of the bisection method in detail.
- Program Design: How did you design your program? What are the inputs and outputs? How many sections did your program have? How did you design each section? A flow chart is also necessary.
- Program Code:
-
Main program
Create a data dictionary defining the meanings of all of the variables in your program. For example,
% a---apple
% b---banana
Then write your statements and make sure to add a comment for each statement. For example,
c=a+b; % to obtain the total amount of apples and bananas
Function 1
Comment lines for brief introduction and how to use this function. For example,
function distance = dist2 (x1, y1, x2, y2)
%DIST2 Calculate the distance between two points
% Function DIST2 calculates the distance between
% two points (x1,y1) and (x2,y2) in a Cartesian coordinate system.
%
% Calling sequence:
% distance = dist2(x1, y1, x2, y2)
% Define variables:
% x1 x-position of point 1
% y1 y-position of point 1
% x2 x-position of point 2
% y2 y-position of point 2
% distance Distance between points
Statements;% comment
end
Function 2
Function 3
-
Please Provide Screenshots of program results [The Code Editor with Codes and The function curves OUTPUT)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started