function [ x ] = Chase_method( A, b )
%Chase method 追赶法求三对角矩阵的解
% A为三对角矩阵的系数,b为等式右端的常数项,返回值x即为最终的解
% 注:A尽量枝败为方阵,b一定要为列向量
%% 求追赶法所需L及U
T = A
for i = 2 : size(T,1)
T(i,i-1) = T(i,i-1)/T(i-1,i-1)
T(i,i) = T(i,i) - T(i-1,i) * T(i,i-1)
end
L = zeros(size(T))
L(logical(eye(size(T)))) = 1 %对角线赋值1
for i = 2:size(T,1)
for j = i-1:size(T,1)
L(i,j) = T(i,j)
break
end
end
U = zeros(size(T))
U(logical(eye(size(T)))) = T(logical(eye(size(T))))
for i = 1:size(T,1)
for j = i+1:size(T,1)
U(i,j) = T(i,j)
break
end
end
%% 利用matlab解矩阵方程的闷锋遍历直接求解
y = L\b
x = U\y
en
计算逗团烂图像线性组合: Z = imlincomb(K1,A1,K2,A2,...,Kn,An) computes K1*A1 + K2*A2 + ... + Kn*An 例山漏子或念:I = imread('cameraman.tif')J = uint8(filter2(fspecial('gaussian'), I))K = imlincomb(1,I,-1,J,128)% K(r,c) = I(r,c) - J(r,c...欢迎分享,转载请注明来源:内存溢出
评论列表(0条)