필터 지우기
필터 지우기

Evaluating a function defined by "sym" command

조회 수: 3 (최근 30일)
SAZZAD HOSSAIN
SAZZAD HOSSAIN 2013년 11월 19일
댓글: SAZZAD HOSSAIN 2013년 11월 19일
Hello
I am using "sym" command to define the variables in small expressions that form the elements of a matrix. Eventually i have to diagonalize the matrix to find eigenvalues. With sym command lets say i define -
f = a*x^2+b*x;
Now i want to evaluate the magnitude of 'f' by putting in numerical values for a,b and x. a and b are constants but x would be an array. How can define the values of a,b and x to find numerical answer for f under these circumstance?
Thanks

채택된 답변

Sean de Wolski
Sean de Wolski 2013년 11월 19일
Use subs:
syms a b x
f = a*x^2+b*x;
subs(f,{a,b,x},{1,2,magic(3)})
And for more info:
doc subs

추가 답변 (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!

Translated by