Clear Filters
Clear Filters

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

1 view (last 30 days)
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)

Answers (1)

Cris LaPierre
Cris LaPierre on 22 Oct 2021
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

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!