Coding the Jacobian efficiently in MATLAB

8 次查看(过去 30 天)
How the Jacobian of F(t,u)= Au - u/1+u be computed in MATLAB? A is a square matrix. How best to compute the Jacobian in Exponential Rosenbrock integrator?
function Jn = J(u)
Jn = -A-1./(1+u).^2;
end

采纳的回答

Matt J
Matt J 2024-5-14
编辑:Matt J 2024-5-14
minusA = -A;
J=@(u) JacobianEngine(u,minusA);
function Jn = JacobianEngine(u,Jn)
p=numel(u);
Jn(1:p+1:end)= Jn(1:p+1:end) + (-1./(1+u).^2);
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by