DISCOVER
×

How to solve transcendental equations in matlab

Updated July 20, 2017

MATLAB is a powerful numerical computing program created by The MathWorks. MATLAB is also a high level programming language that allows potentially complicated numerical programs to be written in a short series of steps. MATLAB can also be integrated with programs written in other languages, and MATLAB also has a number of "toolboxes" supported by The MathWorks that can simplify any analyses you do. One such example is the Symbolic Math toolbox, which allows the user to solve algebraic equations, including transcendental equations (that is, an equation which contains a transcendental function, such as sine). This can be accomplished in a few short steps within MATLAB.

Define the variable you would like to solve using the "syms" command. For example, the command

syms x;

defines the variable to be solved as "x". Press enter.

Write down the equation you wish to solve as a string. This gives

s = 'sin(x) = x^3 - 1';

Use the 'solve' command (contained within the Symbolic Math toolbox) to solve the string 's'. To do this in MATLAB, simply input the command:

solve(s);

This gives the numeric solution to sin(x) = x^3 -1, which is x = 1.24905. This is the solution to the transcendental equation.

Tip

If the right-hand side of the equation you wish to solve is zero, specify the left-hand side only of the equation as a string. If the right-hand side is non-zero, specify the entire equation as a string.

Warning

Ensure you use proper MATLAB syntax when solving equations within MATLAB. Note that any solutions in MATLAB are only approximate, and are rounded down, depending on the accuracy desired in MATLAB.

Things You'll Need

  • Computer with MATLAB program and Symbolic Math toolbox
Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Thomas Bourdin began writing professionally in 2010. He writes for various websites, where his interests include science, computers and music. He holds a Bachelor of Science degree in physics with a minor in mathematics from the University of Saskatchewan and a Master of Science in physics from Ryerson University.