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

Integral problem in Matlab

  1. Jul 2, 2012 #1
    I want to find the definite integral of


    ,over [0,pi/2].

    I ran the following code in Matlab,

    "syms w

    double(vpa(int(acos((w + 1)^(1/2)/10)/(w^(1/2)*(w + 1)^(3/2)),w,0,pi/2)))"

    and got this error message,

    "??? Error using ==> mupadmex
    Error in MuPAD command: DOUBLE cannot convert the input expression into a
    double array.

    If the input expression contains a symbolic variable, use the VPA function

    Error in ==> sym.sym>sym.double at 936
    Xstr = mupadmex('symobj::double', S.s, 0);

    Error in ==> HW at 4
    double(vpa(int(acos((w + 1)^(1/2)/10)/(w^(1/2)*(w + 1)^(3/2)),w,0,pi/2)))".

    Anybody has met such situation like me before? I appreciate any comment!
  2. jcsd
  3. Jul 2, 2012 #2
    Hello there! I think that int() cannot be used here, since the integral will need to be evaluated numerically. Try using quadl() instead:

    Code (Text):
    this = @(w)acos((w+1).^(1/2)/10)./(w.^(1/2).*(w+1).^(3/2)); % note the elementwise operations (.^, ./, .*)

    Hopefully that helps!
  4. Jul 2, 2012 #3
    Thanks a lot! It exactly settles the issue.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Integral problem in Matlab
  1. Integration problem (Replies: 4)

  2. Integration problems (Replies: 3)

  3. Integral problem (Replies: 3)