Jacobian of a state matrix over time using jacobianest

13 ビュー (過去 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 Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by