Borrar filtros
Borrar filtros

Solving algebraic equations without using symbolic variables

8 visualizaciones (últimos 30 días)
How do you solve an algebraic equation like x+y=2 for x without using symbolic variables - for example by defining a function handle y = 1; f = @(x) x+y and setting it equal to 2? Y's value is known so only x needs to be found.
  2 comentarios
David Hill
David Hill el 11 de Feb. de 2022
Your question is trival. I have a hard time understanding your question.
Aleem Andrew
Aleem Andrew el 11 de Feb. de 2022
It's not trivial simply because you can't understand it and besides that's just an example.

Iniciar sesión para comentar.

Respuesta aceptada

Steven Lord
Steven Lord el 11 de Feb. de 2022
For one equation in one unknown, use fzero.
y = 1;
f = @(x) x + y;
initialGuess = 42;
% Find a zero of f(x) - 2 = 0 which is equivalent to f(x) = 2
x = fzero(@(x) f(x) - 2, initialGuess)
x = 1
check = f(x) % Should be close to 2
check = 2

Más respuestas (0)


Community Treasure Hunt

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

Start Hunting!

Translated by