In Matlab®, there are various kinds of functions are defined for the user to use in mathematical calculations generally. Sometimes, it is required to rewrite or change the form of an equation or expression.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
You can do this kind of thing in Matlab® with the ‘rewrite()’ command. Here, we show you how to use the ‘rewrite()’ command to re-express the functions and terms with very basic examples below which are executed in the command window.
How To Use ‘rewrite()’ Command In Matlab®?
>> syms x rewrite(sin(x)+cos(x),'exp') rewrite(acosh(x)+asinh(x), 'log') ans = exp(-x*1i)*(1/2 + 1i/2) + exp(x*1i)*(1/2 - 1i/2) ans = log(x + (x - 1)^(1/2)*(x + 1)^(1/2)) + log(x + (x^2 + 1)^(1/2)) >>
First of all, we created a symbolic variable ‘x’ with the ‘syms’ command to express our functions with this variable. In the ‘rewrite()’ command, the first term is the function that we have, which can be prepared with the default mathematical function of Matlab®. And second terms must be the form of the function that we want to obtain.
In the first example, we want to obtain the exponential form of the first trigonometric function. Take a look at the first example to understand it.
In the second example, we want to obtain the logarithmic form of the first hyperbolic trigonometric function.
Look at the second answer.
To obtain correct results from the ‘rewrite()’ command in Matlab®, you need to use input and output functions that make sense in terms of calculus. But it is a very useful command for specific operations.
Do not forget to leave your comments and questions below about the use of base conversion commands in Matlab® below.
If you want further coding examples about ‘sym’ and ‘syms’ commands in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes.
Your precious feedbacks are very important to us.