Is there a way to choose the ordering of the input variables when using matlabFunction on a symbolic expression?
I would like to use exactly those names for my symbolic variables as it makes it easier for me to follow along with the theory (backward Euler on Hamiltonian system - I have simplified my function to isolate the issue).
syms p11 p12 q11 q12 p01 p02 q01 q02
F = [p11; p12; q11; q12] - [p01; p02; q01; q02];
F = matlabFunction(F);
What I would like:
F =@(p11, p12, q11, q12, p01, p02, q01, q02) ...
What I get:
F =@(p01, p02, p11, p12, q01, q02, q11, q12) ...
Is there a better solution than the following?
FF =@(p11, p12, q11, q12, p01, p02, q01, q02) F(p01, p02, p11, p12, q01, q02, q11, q12);

 채택된 답변

Steven Lord
Steven Lord 2022년 2월 7일

0 개 추천

See the 'Vars' name-value pair argument in the documentation for matlabFunction.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by