MATLAB: Solving an integral with variable as upper limit and plotting the solution

integral with varying upper limit

How can I solve an integral when the upper limit is a variable, and then plot the solution? My integral is as follows: Integral of e^(-(y^2))dy and my upper limit is x, while the lower limit is negative infinity. X and y are variables. I have tried using the trapz function, but then you must have a constant as upper limit. I have also tried using the int-funtion, but that is only solving for an indefinite integral. Does anyone know what I should do?

Best Answer

Your function is equal to
sqrt(pi)/2*(1+erf(x))
Best wishes
Torsten.