1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab intergrals

  1. May 6, 2010 #1
    1. The problem statement, all variables and given/known data
    Let us consider an approximation to an integral. Let f(x) be some continuous function on
    [a, b]. We wish to find an approximation for the integral
    I = int from a to b of f(x)dx
    in the following manner:
    Subdivide the interval into N intervals of length h = (b−a)/N. Let xi = ih for i = 0, . . . ,N.
    Ij = int from 0 to h of f(xj+t)dt

    Find a cubic polynomial Pj (x) that goes through (xj , f(xj)), (xj + h/3,f(xj + h/3)),(xj+2h/3, f(xj+2h/3) and (xj+1,f(xj+1))
    We form an approximation for the integral by letting
    I=sum(j=0 to N-1) of w0*f(xj)+w1*f(xj+h/3)+w2*f(xj+2h/3)+w3*f(xj+1)
    Find these weights, wi.
    In 2 peices of code, plot the first three Bessel functions, J0(x), J1(x) and J2(x), on the
    interval [0, 20]. The first peice of code should be a MATLAB function BJ(x, n) outputing
    the approximation for the integral representation of Jn, given by
    Jn(x) =(1/pi)int from 0 to pi of cos(nt − x sin t)dt
    using the above method for 100 subdivisions of [0, pi]. The second peice of code should call
    the function an produce the required plots with 2000 subdivisions of [0, 20].

    Im just gobsmacked with this qn.. as i only started using matlab a couple of days, ago and have no programming experience.

    what i have done so far is really no good, but i have no idea.

    function [Jn]=BJ(x,n)
    for i=0:N;

    can someone please help me
  2. jcsd
  3. May 7, 2010 #2
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Matlab intergrals Date
Rewriting ODE's into lower orders Nov 15, 2016
Matrix riccati differential equation using matlab Aug 5, 2016
Convolution in MATLAB Sep 28, 2015
Matlab help Jul 12, 2015
Matlab - how to intergrate? May 20, 2011