Derivations are very important in calculus or mathematics. In Matlab®, derivations are very basic with the ‘diff()’ command. Here, we explain how to use the ‘diff()’ command in Matlab® to perform derivations.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
Take a look at the example below to understand the syntax and the use of the ‘diff()’ command.
How To Use ‘diff()’ Command In MatLab®
>> syms a b x = diff(3*a^6+7*a*b^5+3*a*b+3,a,3) x = 360*a^3 >>
As you can see above, we created two symbolic variables with the syms command to obtain our equation inside the ‘diff()’ command. Then we created our equation firstly inside ‘diff()’ as you see above. The equation must be created with the Matlab® syntax.
The second value inside the ‘diff()’ command above is the according to which variable, you will perform derivation, which is ‘a’ here.
The third term is the degree of derivation which is ‘3’ here.
You can directly see the answer in the command window above.
As you see above, the use of the ‘diff()’ command to calculate derivatives in Matlab® is very simple.
Do not forget to leave your comments and questions below about the use of the ‘diff()’ command in Matlab® below.
If you want further coding examples about the ‘diff()’ command in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.
Leave a Reply