00:01
In this question, we have to write a code in matlab.
00:05
So let us look at the little workflow that we will follow, approach that we'll follow to this code.
00:15
So the code iteratively will improve in this case till the initial guess using the fixed point iteration method until convergence is achieved.
00:30
So for here we will use a fixed point iteration method.
00:39
Now this method will allow us to improve the initial guess here and it will be called again to obtain the solution at the 25th iteration of whatever equation is given to us in the question.
00:59
Then next we have to do this until the convergence is achieved or the maximum number of iterations is reached.
01:06
Then we have to calculate the desired values based on the solutions that we will obtain.
01:14
So let us look into matlab on how we will be solving this question.
01:21
For that i'm using a basic compiler.
01:24
So here first thing that we will do is we will give or we will define the fixed point iteration function that i just told you.
01:40
So it will take four inputs as arguments.
01:44
Let us see what they are.
01:49
So as you can see here we have defined a fixed point iteration function and it has four arguments that is rhs, xo, max iteration and tolerance.
02:01
So let us see what these functions do.
02:07
So rhs is for function handle for evaluating the right hand sides of the equation.
02:14
Then xo is the initial guess for the unknowns.
02:19
Then max iteration is the maximum number of iterations and tol is tolerance for conversion.
02:26
So now these function performs the fixed point iteration to solve a system of equation.
02:33
So now inside the fixed point iteration function the number of unknowns we have to each we have to give for that we will first write them i'll also note down the comment for what they are.
02:49
So as you can see here that the right hand side as you can see here that inside the fixed point iteration n is the number of unknowns n that is determined based on the length of the initial guess xo or x0 and the initial guess x and the previous solution x preview are initialized with x0.
03:19
So the main iteration loop will start which runs for a maximum iteration.
03:25
So for that we will use a for loop now.
03:32
So as you can see here i have used a for loop now in this loop the right hand side of the equation are evaluated by solving by calling the function that is rhs x this the function rhs should be defined separately and should return a vector of the same size as x containing the right hand sides of the equation.
04:00
So i have written it here...