For expmv it works. It's actually the matrix exponential vector product that I need, so I can apply CST on expmv.
Complex Step Derivative of 3D rotation in exponential coordinates at u = [0 0 0] not working?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Applying complex step differentiation to the matrix exponential works fine, except at u = [0 0 0]. Here, the exponential coordinates have a removable singularity. Why does the complex differentiation fail only at this point? Can you think of a complex differentiable matrix exponential that returns the correct derivative at u = [0 0 0]? Similar to the Complex-step-compatible atan2()?
Thank you for your time.
u0 = [0;0;0]; % The problematic point
% Central finite-difference
sh = 1e-5;
for ii = 1:3
dh = zeros(3,1);
dh(ii) = sh;
JFD(:,ii) = (vec(rexpm(u0+dh)) - vec(rexpm(u0-dh))) / (2*sh);
end
% Complex step differentiation
sh = 1e-16;
for ii = 1:3
dh = zeros(3,1);
dh(ii) = sh*1i;
JCS(:,ii) = imag(vec(rexpm(u0+dh))) / (sh);
end
JFD - JCS % should be close to 0!
% Functions
function R = rexpm(u)
Su = [ 0 -u(3) u(2)
u(3) 0 -u(1)
-u(2) u(1) 0];
R = expm(Su);
end
function y = vec(x)
y = x(:);
end
Respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!