- How can I create a matlabFunction for each expression without manually defining each one?
How to create multiple matlabFunctions from an array containing symbolic expressions?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have an array containing a number of symbolic expressions, for example:
syms x y z
expressions = [x, y, z, x^2, y^2, z^2, x*y, x*z, y*z];
How can I create a matlabFunction for each expression without manually defining each one?
Is it possible to create an array of matlabFunctions?
Thanks
댓글 수: 2
darova
2020년 2월 24일
What about matlabFunction?
답변 (1개)
Sahithi Metpalli
2020년 3월 2일
According to my understanding you can use a cell array of function handles for the symbolic expressions using the inbuilt function matlabFunction as shown below.
syms x y z
expressions = [x, y, z, x^2, y^2, z^2, x*y, x*z, y*z];
for i=1:length(expressions)
FunctionHandle{i} = matlabFunction(expressions(i));
end
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!