Hello,
I'm searching for a way to apply the Jacobian function to each row of a matrix. Essentially I need to access each row of a matrix and apply a function. I could use a "for loop" which is quite slow:
for i=1:size(a,1) tmp = jacobian(a(i,:),b); result=cat(1,result,tmp);end
I also found this solution:
function dNdv = matjacobian(N,v) rz = arrayfun(@(ii)jacobian(N(ii,:),v),(1:numel(N(:,1))).','un',0); dNdv = cat(1,rz{:});end
The second solution is faster but I'm wondering if there is a more efficient way. Or even a way to apply the jacobian to a multi row matrix.
Thanks in advance,
Chris
Best Answer