How can I make a symbolic function with vector input?

조회 수: 1 (최근 30일)
Hansol Lee
Hansol Lee 2020년 4월 21일
답변: Jyotsna Talluri 2020년 4월 24일
I want to make a symbolic function with vector input.
I tried a code
a=sym('a',[1 3]);
f(a)=a(1)^2+a(2)+a(3)*a(1);
k=[1 1 1];
f(k)
But it didn't work. I could find that f(1,1,1) works, but I want to make f with f([1 1 1]). How could I do it?

채택된 답변

Jyotsna Talluri
Jyotsna Talluri 2020년 4월 24일
a=sym('a',[1 3]);
f= @(a)(a(1)^2+a(2)+a(3)*a(1));
k=[1 1 1];
f(k)

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!