Iteration and Convergence to zero
4 views (last 30 days)
Show older comments
The matrix is attached as ('Note.xlsx').
[num, txt, raw]= xlsread('Note');
format short;
A1= num(1:5, 1:5);
row_sum= A1(1:3,4);
col_sum= A1(4,1:3);
u= A1(1:3, 5); % This is the true or prescribed row sum
v= A1(5, 1:3); % This is the true or prescribed column sum.
aij_0= A1(1:3, 1:3); % This is my origional matrix.
r= u./row_sum % This is row multiplier.
aij_r= aij_o.*r; % Mulitply the origional matrix by r(row multiplier).
% Now row and column sum is changed so i have to find the new row and column sum. But the 'u' and 'v' remain same for the whole process.
row_sum_new= sum(aij_r, 2);
col_sum_new= sum(aij_r,1);
s = v./col_sum_new; % This is column multiplier.
% Now i have to multiply the 'aij_r' matrix by s. And then we will have new matrix( aij_1).
aij_1= aij_r.*s;
% Then I have to find the row sum and find r to multiply aij_1.r....and then find col_sum and find s. And multiply aij_2.
% This process coutinue until we dont have Row sum= u(prescribed row sum) and Column sum = v( prescribed column sum).
% I need this final matrix. I need your help, please.
0 Comments
Answers (1)
Raunak Gupta
on 20 Mar 2020
Hi,
I don’t fully understand the logic implemented here but I think after each iteration you want to check the value of r and s. If these values are 1 (or close to 1), the solution is reached. I think you may use while loop for doing the above computation till the convergence or if the above things can be formalized into some equations then it can be solved with the help of Optimization Toolbox.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!