• 大小: 2KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: Matlab
  • 标签: 牛顿法  matlab  

资源简介

牛顿法牛顿法牛顿法牛顿法牛顿法牛顿法牛顿法牛顿法牛顿法牛顿法

代码片段和文件信息

function [x y] = newtonAbx0niter
%[x y] = newtonAbx0niter);
%solves the linear least squares problem with nonnegative variables using the newtons algorithm in [1].
%Input:
%   A:      [MxN] matrix 
%   b:      [Mx1] vector
%   x0:     [Nx1] vector of initial valuesx0 > 0. Default valueonesn1
%   niter:  Number of iterationsDefault value: 10
%Output
%   x:      solution
%   y:      complementary solution
%
[1] Portugal Judice and Vicente A comparison of block pivoting and
interior point algorithms for linear least squares problems with
nonnegative variables Mathematics of Computation 63(1994) pp. 625-643
%
%Uriel Roque
%02.05.2006

[mn] = sizeA);

if nargin < 3
    x0 = onesn1);
    niter = 10;
elseif nargin < 4
    niter = 10;
end

if isemptyx0
    x0 = onesn1);
elseif anyx0 <= 0)
    disp(‘ErrorThe initial vector should be nonzero‘);
    x = [];
    y = [];
    return
end

AtA = A‘*A;
Atb = A‘*b;

In = e

评论

共有 条评论