Creating and differentiating symbolic functions with vector inputs of different dimensions

Hi,
I would like to do the following:
1) Define a callable symbolic function F of variables X and Y, where X and Y are vectors of different dimensions.
2) Then, take the Jacobian of F with respect to either X or Y, and not the individual elements of X and Y.
Is there a way to do this?
Thanks! Stephanie

 채택된 답변

Stephanie
Stephanie 2013년 8월 28일
I solved the problem. Here's the solution:
  1. Reshape and combine X and Y into one row vector.
  2. Call symfun with the row vector as the second input to create the function f.
Once we have the function f, we can take its jacobian with the original vectors X and Y to produce another symbolic function.
When calling f, to take its Jacobian for instance:
  1. Put all of the inputs into a row vector.
  2. use num2cell to convert the row vector into a cell array, called "symbolic_input"
  3. Call f: f(symbolic_input{:})

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2013년 8월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by