Integrations are a very important aspect of calculus and mathematics. Maybe they are the hardest thing to do with the hand. For sam integration problems, you need to have a very good ability to integrate and you need to know all the integration rules.
YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!
MatLab® provides a very useful command for integration operations. You can make all the integration operations in Matlab® with the ‘int()’ command. Here, we explain how to use the ‘int()’ command in MatLab® to perform integration with very basic coding examples below. All the codes are executed in the MatLab® command window.
How To Use ‘int()’ Command In MatLab®?
>> syms x y int(x^3 - y^3 + 3*x*y^2^2 + 8*x + 3*y, y, -100, 100) ans = 200*x*(x^2 + 60000008) >>
You can see the very basic example above to perform the required integration in Matlab®. First of all, we created symbolic variables ‘x’ and ‘y’ with the ‘syms’ command.
In the ‘int()’ command, our first element between brackets is the equation written with the symbolic variables ‘x’ and ‘y’. The second element inside brackets is the variable that we want to perform integration with respect to that. We want to perform integration with respect to ‘y’ in here.
The third and last terms which are ‘-100’ and ‘100’ here, are the boundaries that we want to perform the integration.
If you hit the ‘Enter’ key, the integration will be calculated.
Performing Indefinite Integrals In MatLab®
>> syms x y int(x^3 - y^3 + 3*x*y^2^2 + 8*x + 3*y, y) ans = (3*x*y^5)/5 + (3*y^2)/2 - y^4/4 + y*(x^3 + 8*x) >>
You can also perform indefinite integrals with the ‘int()’ command. As you see in the code above, the only difference is, there is no definition of boundaries for integration.
Indefinite integrals are calculated in Matlab® like this.
Integrals Have Only One Variable
>> syms x int(x^3 + 3*x + 8) ans = (x*(x^3 + 6*x + 32))/4 >>
If your integration has only one variable, you do not need to write the second element to define respect to which variable that you want to perform the integration. ‘int()’ command will automatically solve the problem.
As you see above, integrations are very easy in Matlab® with the ‘int()’ command.
Do not forget to leave your comments and questions below about the use of the ‘int()’ command to perform integrations in Matlab® below.
If you want further coding examples about the ‘int()’ command 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.