필터 지우기
필터 지우기

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
darova 2020년 2월 24일
  • How can I create a matlabFunction for each expression without manually defining each one?
What about matlabFunction?
snhah
snhah 2020년 2월 24일
편집: snhah 2020년 2월 24일
@darova I mean, say for example, in a for loop...

댓글을 달려면 로그인하십시오.

답변 (1개)

Sahithi Metpalli
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

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by