How to rewrite a non-linear function so that f(x) = 0?
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (4)
Honglei Chen
el 16 de Dic. de 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
el 16 de Dic. de 2011
0 votos
Sean de Wolski
el 16 de Dic. de 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
el 16 de Dic. de 2011
0 votos
Categorías
Más información sobre Optimization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!