M-files to solve numerical integration

Click For Summary

Discussion Overview

The discussion revolves around numerical integration using MATLAB m-files, specifically applying the trapezium rule to find the area under the curve of the function g(x) = x^2 from x=0 to x=2. Participants explore how to implement this in MATLAB.

Discussion Character

  • Homework-related, Technical explanation

Main Points Raised

  • One participant presents a homework statement involving numerical integration using the trapezium rule.
  • Another participant requests a solution attempt, emphasizing that the forum does not provide direct answers to homework questions.
  • A different participant clarifies that they are experimenting with MATLAB and seeks guidance on programming the m-file, indicating a lack of familiarity with the software.
  • Another participant suggests using the "trapz" command in MATLAB, recommending that the user consult the help files for further information.

Areas of Agreement / Disagreement

There is no consensus on a solution, as participants express different levels of familiarity with MATLAB and the task at hand. The discussion remains open with varying degrees of support and inquiry.

Contextual Notes

Participants have not fully defined the parameters of the numerical integration task, and there may be assumptions regarding the user's prior knowledge of MATLAB that are not explicitly stated.

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 ·
Replies
11
Views
3K
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K