赞
踩
主要用于求解超定方程的未知解
实现代码见博客最下方
clear;
format long;
A = randn([10000 10]);
b = randn([10000 1]);
x = rand(10,1);
I = eye(10, 10);
P = (10^6) * I;
for k = 1:10000
Ak = A(k,:);
Q1 = P*(Ak');
Q2 = 1 + Ak * P * (Ak');
Q = Q1/Q2;
x = x + Q * (b(k) - Ak*x);
P = (I - Q*Ak)*P;
result2(:,k) = x;
result1(k) = k;
end
result1 = result1';
%result = [result1; result2];
plot(result1, result2);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。