# Thread: Kac Formula plot with MatLab

1. ## Kac Formula plot with MatLab

I am trying to plot the Kac Formula with MatLab and I am having trouble.
Here's a link to the formula
Kac Formula -- from Wolfram MathWorld
Any help would be greatly appreciated.

2. Originally Posted by YankeesFan
I am trying to plot the Kac Formula with MatLab and I am having trouble.
Here's a link to the formula
Kac Formula -- from Wolfram MathWorld
Any help would be greatly appreciated.
First you write a function to evaluate $I_n(t)$, Now we want:

$E_n=\frac{1}{\pi}\int_{-\infty}^{\infty}I_n(t)\; dt$

In order to get rid of the infinite range of integration we make a change of variable: $u=\arctan(t)$ and the integral becomes:

$E_n=\frac{1}{\pi}\int_{-\pi/2}^{\pi/2}\frac{I_n(\tan(u))}{\cos^2(u)}\; du$

Now you use Matlab quad function to evaluate this.

CB