M-files to solve numerical integration

AI Thread Summary
The discussion focuses on using MATLAB m-files for numerical integration, specifically applying the trapezium rule to find the area under the curve of g(x) = x^2 from x=0 to x=2. The area of a trapezium is defined as h/2(a+b). A user expresses difficulty in programming the m-file due to their inexperience with MATLAB. Another participant suggests using the "trapz" command, which is designed for numerical integration using the trapezoidal rule. The conversation emphasizes the importance of seeking help and utilizing available resources in MATLAB.
mazi
Messages
2
Reaction score
0

Homework Statement



Numerical integration using MATLAB m-files
Find the area under the curve of:
using trapezium rule

Homework Equations



g(x) = x^2 from x=0 to x=2
Area of a trapezium = h/2(a+b)

The Attempt at a Solution

 
Physics news on Phys.org
Please attempt a solution and share it with us. Physics Forums does not do your homework for you.
 
I am actually trying out something. it is not my homework and i have no idea since i am new to MATLAB software. can't figure out how to program the mfile
 
You can use the command "trapz", look it up in the help files. It integrates a numerical sequence using the trapezoidal rule.
 
Last edited:

Similar threads

Replies
11
Views
2K
Replies
7
Views
2K
Replies
3
Views
2K
Replies
1
Views
3K
Replies
9
Views
1K
Replies
11
Views
4K
Replies
6
Views
2K
Replies
13
Views
2K
Back
Top