⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sor.m

📁 Mathematical Methods by Moor n Stiling.
💻 M
字号:
function x = sor(A,x,b,omega)
% 
% Produce an updated solution x to Ax = b successive over-relaxation
% A must be Hermitian positive definite
%
% function x = sor(A,x,b)
%
% A = input matrix
% x = initial solution
% b = right-hand side
% omega = relaxation parameter
% 
% Output x= updated solution

% Copyright 1999 by Todd K. Moon

[m,n] = size(A); if(n ~= m) error('Error: matrix needs to be square'); end;
D = diag(diag(A));  Cl = tril(A,-1);  Cu = triu(A,1);
% the following should be set up and stored if this is used iteratively
omegaQ = D + omega*Cl;                   % omega * Q
omegaQmA = (1-omega)*D - omega*Cu;       % omega * (Q-A)
% The update step:
x = backsub(omegaQ, omegaQmA*x + omega*b);

⌨️ 快捷键说明

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