フィルターのクリア

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 Center および File ExchangeFunction Creation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by