필터 지우기
필터 지우기

How can I generate a matrix of symbolic functions, whose size varies depending on the input values?

조회 수: 2 (최근 30일)
For example, I want to generate 4 symbolic functions which depend on the variable 't'. They should be something like th1(t), th2(t), th3(t), and th4(t). It's easy to define these variables when the number of variables is less and that number is constant. How can I automatically get a matrix of functions whose size may vary?

채택된 답변

madhan ravi
madhan ravi 2018년 11월 3일
편집: madhan ravi 2018년 11월 3일
  댓글 수: 13
Walter Roberson
Walter Roberson 2018년 11월 5일
Use a cell array of symbolic functions.
TH = sprintfc('th%d(t)', 1:n);
funs = arrayfun( @(th) sym(th), TH, 'uniform', 0);
Now funs{1} through funs{n}

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by