Jacobian of a state matrix over time using jacobianest

조회 수: 17 (최근 30일)
Shelley Snider
Shelley Snider 2021년 6월 20일
편집: Matt J 2021년 6월 20일
I'm using the DERIVESTsuite toolbox to find the jacobian with respect to a state array over time. I have a function with inputs
1. `x`- state array (n x m). Where n is the number of states and m is the number of time nodes.
2. `u`- control vector (1 x m)
3. `t`- time vector (1 x m)
4. `constants`- structure of constants
I currently have my code looping through each time node to give me an nxn matrix for each time node.:
for i = length(t):-1:1 % Jacobian of state vector at each node
A(:,:,i) = jacobianest(@(x) eom(x,u(i),t(i),constants),x(:,i));
end
Is there a way to do this without looping through each time node? I know that the following code gives me a matrix A which is (n*m x n*m).
A = jacobianest(@(x) F(x,u,t,constants),x);
Can I extract what I'm looking for from this or is there a better way to use jacobianest?

답변 (1개)

Matt J
Matt J 2021년 6월 20일
편집: Matt J 2021년 6월 20일
I don't think there is anything sub-optimal about the way you're using jacobianest now. In fact, by keeping the loop external to jacobianest, you have the possibility of using a parfor loop, which might speed things up. I'm assuming you wouldn't consider going inside jacobianest.m and changing the for-loops there to parfor loops.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by