필터 지우기
필터 지우기

i have problem in uses of inline or syms ordes

조회 수: 1 (최근 30일)
xosro
xosro 2015년 5월 16일
댓글: Walter Roberson 2015년 5월 16일
i want have a variable like x that define on x ,f(x) function,then program does math operators on f(x) and compute the result of this operators for specified x,
for example in During the a code i want define x with syms order and obtain f=x^2+x+1, then compute f(1)^2

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 16일
syms x
f = x^2+x+1;
subs(f^2,x,1)
  댓글 수: 3
xosro
xosro 2015년 5월 16일
편집: Walter Roberson 2015년 5월 16일
your answer has was correct but matlab does not know answer of subs(y^2,x,1) as a logic number for example when i run
>>syms x
>>f = x^2+x+1;
>>subs(f^2,x,1)
>>ans=
>> ans>1
ans =
1 < 9
Walter Roberson
Walter Roberson 2015년 5월 16일
The result of a computation with symbolic values is a symbolic value. If you want the closest floating point equivalent, double() the symbolic value. For example,
double(subs(f^2,x,1))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by