Understanding Integration in MATLAB: A Case Study

In summary, the conversation is about using MATLAB to calculate the integration of a basic function. The user has written a function and used the "quad" command to calculate the integral from 0.01 to 0.05, but the answer shown is 0.059, which is different from the real answer of 0.361. Upon further analysis, the user realizes that the function is increasing and the maximum value at 0.05 is 0.3834. The user also overestimates the integral and finds that the answer of 0.0059 given by "quad" is closer to the real answer. They conclude that their command is correct and thank the expert for their help.
  • #1
furkang
9
0
I used MATLAB to calculate the integration of a basic function.
I wrote :

F = inline('(2*x)+((x.^3)/0.000441)')

Q = quad(F,0.01,0.05)

I want to calculate integral of F from 0.01 to 0.05
the answer shown is 0.059
but the real answer is 0.361

I am sure the function F is correct (I have tried some values).

is there any problem with "Q = quad(F,0.01,0.05)" command?
Thank you for your help...
 
Physics news on Phys.org
  • #2
Why do you think the real answer is 0.361?
I see that
F(0.05) - F(0.01) = 0.361
but this is of course not the integral, the integral is smaller.

The function is increasing and so on the interval [0.01, 0.05] it is maximum at 0.05, there it is 0.3834. Overestimating the integral by assuming that F would be 0.3834 everywhere in the interval [0.01, 0.05] would give an area: 0.3834 * 0.04 = 0.0153
which is close to 0.0059 (the answer that quad gives).
I think 0.0059 is the right answer.
 
  • #3
gerben said:
Why do you think the real answer is 0.361?
I see that
F(0.05) - F(0.01) = 0.361
but this is of course not the integral, the integral is smaller.

The function is increasing and so on the interval [0.01, 0.05] it is maximum at 0.05, there it is 0.3834. Overestimating the integral by assuming that F would be 0.3834 everywhere in the interval [0.01, 0.05] would give an area: 0.3834 * 0.04 = 0.0153
which is close to 0.0059 (the answer that quad gives).
I think 0.0059 is the right answer.


ok now 1ve got it , 1 made a big mistake but 1 am happy to know my command is true . Thank you again
:smile:
 

1. What is Matlab and how is it used for integration?

Matlab is a programming language and software platform commonly used in scientific and engineering applications. It is particularly useful for performing numerical computations, such as integration. Matlab has built-in functions and tools specifically designed for integration, making it a popular choice for this task.

2. How do I use Matlab for integration?

To use Matlab for integration, you first need to define the function you want to integrate. This can be done using the "syms" command for symbolic functions or the "inline" command for numeric functions. Then, you can use the "int" function to perform the integration. For more complex integrals, you may need to use additional commands or techniques such as numerical integration methods.

3. Can Matlab handle multidimensional integration?

Yes, Matlab has the capability to handle multidimensional integration. You can specify the variables and limits of integration for each dimension using the "int" function. However, the computation time and accuracy may vary depending on the complexity of the integration.

4. What are the advantages of using Matlab for integration?

One of the main advantages of using Matlab for integration is its speed and efficiency. It has built-in functions and tools optimized for numerical computations, making it faster than other programming languages. Additionally, Matlab has a user-friendly interface and a large community of users, which can provide support and resources for integration tasks.

5. Are there any limitations to using Matlab for integration?

While Matlab is a powerful tool for integration, it does have some limitations. It may not be the best choice for very complex integrals, as it may require additional commands or techniques to achieve accurate results. Additionally, Matlab is a paid software, so it may not be accessible to everyone. There are also open-source alternatives available for integration tasks.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
819
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
993
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
217
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
Back
Top