How to rewrite a non-linear function so that f(x) = 0?
Show older comments
Hello! This is my first question on these forums, so please forgive me if I do anything wrong here :). What I wonder about is how to make MATLAB rewrite a general, non-linear function. Say that I input the function "3cos(x) = x^2" or "e^x = 2x". Is there any function for this? What I want to do with this new, rewritten function is to use it to find the point of zero. This I plan to do with a function of my own, instead of using fzero. Thank you all in advance!
Accepted Answer
More Answers (4)
Honglei Chen
on 16 Dec 2011
Isn't it just
3*cos(x)-x^2
and
exp(x)-2*x
If you have to, you can define function f1(x) for the left side and f2(x) for the other side and then use f1(x)-f2(x). But IMHO it really doesn't save you anything.
Christian Skoog
on 16 Dec 2011
0 votes
Sean de Wolski
on 16 Dec 2011
If you have the Symbolic Math Toolbox, you can just use solve()
solve('exp(x)=2*x')
solve('3*cos(x)=x^2')
doc solve
Welcome to MATLAB Answers!
MORE
syms x
f1 = x^2-3
f2 = cos(x*exp(x))
simple(f2-f1)
Christian Skoog
on 16 Dec 2011
0 votes
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!