Computing the area under a curve with Matlab

Click For Summary

Discussion Overview

The discussion revolves around finding the area under a curve using MATLAB, specifically focusing on the commands and methods available for numerical integration. Participants explore different approaches and clarify their understanding of the commands involved.

Discussion Character

  • Homework-related
  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant inquires about the command for calculating the area under a curve in MATLAB.
  • Another participant suggests using the command quad(f(x),a,b) to evaluate the integral \int_a^b f(x) dx.
  • A participant expresses confusion regarding the difference between the commands "quad" and "quad1" and seeks clarification on whether f(x) represents y=f(x).
  • Another participant proposes two methods for approximating the area under a curve when only a few data points are available: using an approximation polynomial or applying the integral definition with a summation formula.
  • It is noted that both proposed methods yield approximate solutions, and an exact solution requires knowledge of the function f(x).

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding the commands and methods for numerical integration in MATLAB. There is no consensus on the best approach, and confusion remains about specific commands.

Contextual Notes

Participants mention limitations in their methods, such as the need for an exact function f(x) for precise calculations and the approximation nature of the suggested methods.

Who May Find This Useful

This discussion may be useful for individuals looking to understand numerical integration in MATLAB, particularly those working with data points or seeking clarification on specific commands.

Faiza Mustafa
Messages
4
Reaction score
0
how to find the area under the curve by using MATLAB
i mean to say what is the command for this
 
Physics news on Phys.org


please if anybody know about it then please reply me soon
i am worried

Thanks
 
The command to evaluate
[itex] \int_a^b f(x) dx[/itex]
is

Code:
quad(f(x),a,b)
 
Thanks a lot

I shall check it.
 
Hi qntty

hw r u?

thnx for the reply about my problem
in the previous problem i am actually confused between "quad" and "quad1" command
and is the f(x) is y=f(x)? i mean to say the function that relate the y and x.

Do you if there is some data values in excel then how
can we plot these values in matlab.

thnx
 
Hi Faiza,

If you have only few point of your curve, than you may use two ways:
1. Find approximation polynomial and than evaluate integral;
2. Just use following formula (by integral definition):
[tex]\sum_{i=1}^{n-1} f_i(x_{i+1}-x_i) , where f_i=f(x_i)[/tex]

There are some other methods you may find in the Internet.

Note: Both methods gives not exact solutions. For exact solution you have to know f(x)
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K