フィルターのクリア

Why is my last line coming up as an empty sym?

1 回表示 (過去 30 日間)
Amy Joyce Valencia
Amy Joyce Valencia 2021 年 10 月 22 日
コメント済み: Amy Joyce Valencia 2021 年 10 月 22 日
There's a couple steps to this problem. Expand and then simplify the equation. The last is to solve this equation: when x =2. But when I run it, it comes up empty
𝑦= (𝑥^3 +1)(𝑥^2 +2𝑥−5)(𝑥^2 −3)^2
clear
syms x
x==2
y = (x^3+1)*(x^2+2*x-5)*(x^2-3)^2 %deleted "eqn =' double = leads to error
expand(y) %switch out "eqn" with "y"
simplify(y) %same as above
solve(subs(y,x,2),y)

回答 (1 件)

Cris LaPierre
Cris LaPierre 2021 年 10 月 22 日
I don't think you need to use solve in the final line. Substituting in 2 for x will return a value for y. There is nothing left to solve for.
syms x
y = (x^3+1)*(x^2+2*x-5)*(x^2-3)^2 %deleted "eqn =' double = leads to error
y = 
subs(y,x,2)
ans = 
27

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by