Damped Gauss Newton iteration (how to extend a given matrix)
6 views (last 30 days)
Show older comments
Hi so I've ran in to a problem I was wondering if someone could help me resolve. This is my script:
tvec = [0 0.2 0.4 0.6 0.8]'; Pvec = [5.1 5.9 6.4 7.5 8.3]';
F =@(x) x(1)*(exp(x(2).*tvec)) - Pvec;
dFdP0 = @(x) exp(x(2).*tvec);
dFdr = @(x) x(1).*tvec*exp(x(2)).*exp(tvec);
J =@(x) [dFdP0(x), dFdr(x)]; % Jacobianen
x = [5.1 0.5274]'; %[P0. r]
tolerans = 1e-8; [xm,countm] = GaussNewton(F,J,x,tolerans)
And my function:
function [x,count] = GaussNewton1(F,J,x,tolerans)
hnorm = 1;
count = 0;
L = 10
L = L^0.5;
n = size(x)
m = zeros(n,1)
I = eye(n,n)
I = I*L
while (hnorm > tolerans && count<100)
h = J(x)\F(x);
hnorm = norm(h, inf);
x=x-h;
count = count+1;
end
What I wanna do is add write something that looks like (J(x);I)\(F(x);m) but I don't know how to do this in matlab code. Like I wanna extend my jacobian with the I and my F with a column vector of m zeros. Any ideas?
/// Christoffer
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!