Search code examples
matlabmathintegral

Issues calculating simple integral in MATLAB


I want to calculate the following integral with Matlab:

integral x*sin(3x)*e^(x^3) dx from bound 1 to 5.

Use following commands, but not answer my integral.

syms x

f=x*sin(3*x)*exp(x^3);

int (x*sin(3*x)*exp(x^3),x,1,5)

where part of my code is wrong? anyone can help me?


Solution

  • Your procedure is correct. The problem is that Matlab doesn't know an explicit form for the primitive function. It produces the warning

    Warning: Explicit integral could not be found
    

    If you change x^3 to x, for example, there is an explicit integral (which can probably be found integrating by parts, as usual with products of exponential and trigonometric functions):

    >> syms x
    >> int(x*sin(3*x)*exp(x),x,1,5)
    ans =
    (exp(1)*(12*cos(3) - 9*sin(3)))/50 - (exp(5)*(72*cos(15) - 29*sin(15)))/50