# Matlab integral

1. Jan 9, 2012

### dirk_mec1

I want to have a fast way (in Matlab) of computing the following integral:

$$\int_0^z \cos(\theta(z))\ \mbox{d}z\ \forall z \in [0,1]$$

with $$\theta(z) = atan(z) + e^{\int_0^z \chi^2 +a^2\ \mbox{d}\chi}$$

I used an anomyous functions with a quad function to define the $\theta$ then I used a quadv to evalute the integral. Finally I used a for loop to get the integral for a list of discrete values for z in [0,1]. Of course this takes a lot of computation time, I think this has to do with the fact that quad is used in quadv. How can I make this a lot faster?