Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: M-files to solve numerical integration

  1. Mar 21, 2012 #1
    1. The problem statement, all variables and given/known data

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

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

    3. The attempt at a solution
     
  2. jcsd
  3. Mar 21, 2012 #2

    marcusl

    User Avatar
    Science Advisor
    Gold Member

    Please attempt a solution and share it with us. Physics Forums does not do your homework for you.
     
  4. Mar 21, 2012 #3
    I am actually trying out something. it is not my homework and i have no idea since i am new to matlab software. cant figure out how to program the mfile
     
  5. Mar 22, 2012 #4

    marcusl

    User Avatar
    Science Advisor
    Gold Member

    You can use the command "trapz", look it up in the help files. It integrates a numerical sequence using the trapezoidal rule.
     
    Last edited: Mar 22, 2012
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook