definite integral in matlab?

784 Views Asked by At

I have just started learning how to solve definite integrals in matlab, and from the documentation, I picked up this example:

$\int^{\infty}_{0}(e^{-x^2} )dx$ but when I run it in my matlab, I get the error: "The expression to the left of the equals sign is not a valid target for an assignment." (the equals after x, and the second dot after 0 are underlined in red)

what is wrong with this? int() works for me when I try indefinite integrals, but not for this.

1

There are 1 best solutions below

0
On

Try to write:

syms x;

int(exp(-x^2),x,0,inf)

The numerical value should be pi^(1/2)/2.