matrix value in broyden's method

1 次查看(过去 30 天)
ZhenQi
ZhenQi 2013-4-18
Ok guys, for the iteration part of my broyden's method I have:
temp = x;
x = x - jac(x)\f(x);
s = x - temp;
y = f(x) - f(temp);
jac(x) = jac(x) + (y - jac(x)*s)*s'/(s*s);
now when I run this I get an error saying:
Error using * Inner matrix dimensions must agree. Error in broyden (line 32) jac(x) = jac(x) + (y - jac(x)*s)*s'/(s*s);
anyone know why this doesn't work?

回答(1 个)

Andrei Bobrov
Andrei Bobrov 2013-4-18
编辑:Andrei Bobrov 2013-4-18
jac(x) = jac(x) + (y - jac(x)*s)*s.'/(s(:).'*s(:));
or
jac(x) = jac(x) + (y - jac(x)*s)*s.'/norm(s).^2;

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by