definite integral in matlab?

$\begingroup$

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.

$\endgroup$ 3

1 Answer

$\begingroup$

Try to write:

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

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

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like