script.m

来自「jacobi algorithm matlab code」· M 代码 · 共 19 行

M
19
字号
%This script averages the iterations for the Jacobi algorithm with sorting 
%and without sorting for 100 matrices and also averages the difference
%between the two methods.

SortTotal = 0;
NoSortTotal = 0;
DifferenceTotal = 0;
for (i=1:100)
    [Sort,NoSort]=testJacobiSameMatrices2();
    SortTotal = SortTotal + Sort;
    NoSortTotal = NoSortTotal + NoSort;
    DifferenceTotal = DifferenceTotal + (abs(NoSort-Sort));
end
disp('Sort Average');
disp(SortTotal/100);
disp('No Sort Average');
disp(NoSortTotal/100);
disp('Difference Average');
disp(DifferenceTotal/100);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?