Solve Function for Given Range of Inputs
10 次查看(过去 30 天)
显示 更早的评论
syms x
x = sym('x')
x = -4:4
eqn = exp(-x.^2) == f(x)
S = solve(eqn,x)
I keep getting an error message when trying to folve the function f(x) for values of x -4 through 4. How would i define f(x) to get rid of the error message?
2 个评论
Torsten
2022-2-27
How would i define f(x) to get rid of the error message?
Depends on which equation you are trying to solve.
What you write at the moment does not make sense since you already fix x as x=-4:4.
So exp(-x.^2)==f(x) is either true or false depending on f, but you can't solve for x.
回答(1 个)
Walter Roberson
2022-2-27
syms x real
f(x) = sin(x)
eqn = exp(-x.^2) == f(x)
Sn = vpasolve(eqn, x, [-4 4])
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

