- #1
dirk_mec1
- 761
- 13
I want to have a fast way (in Matlab) of computing the following integral:
[tex] \int_0^z \cos(\theta(z))\ \mbox{d}z\ \forall z \in [0,1] [/tex]
with [tex] \theta(z) = atan(z) + e^{\int_0^z \chi^2 +a^2\ \mbox{d}\chi} [/tex]
I used an anomyous functions with a quad function to define the [itex] \theta [/itex] 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?
[tex] \int_0^z \cos(\theta(z))\ \mbox{d}z\ \forall z \in [0,1] [/tex]
with [tex] \theta(z) = atan(z) + e^{\int_0^z \chi^2 +a^2\ \mbox{d}\chi} [/tex]
I used an anomyous functions with a quad function to define the [itex] \theta [/itex] 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?