필터 지우기
필터 지우기

Have matlabFunction create a function handle with two inputs even when the symbolic expression uses only one.

조회 수: 1 (최근 30일)
So I have symbolic expressions which sometimes use only one of the two inputs set in their definition. I want matlabFucntion to create a function handle with the same number of input variables as the symbolic expression, and to place their inputs in the same order as they were defined symbolically.
Here is an example code of what I have done, which I know misses to accomodate the dX_mf function handle's inputs correctly.
syms dX(X,Y) dY(X,Y)
dX = Y
dY = X+Y
dX_mF = matlabFunction(dX) % Here I would want to have dX_mF = @(X,Y) instead of dX_mF = @(Y)
dY_mF = matlabFunction(dY) % This works great, with dY_mF = @(X,Y)
Have a nice day,

채택된 답변

Antonio Mayorquin Galicia
Antonio Mayorquin Galicia 2022년 3월 9일
편집: Antonio Mayorquin Galicia 2022년 3월 9일
Use
dX_mF = matlabFunction(dX, 'Vars' [X Y])
The second part which allows you to change the order of the variables of the function handle inputs.
There is more information in the documentation of matlabFunction.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by