I am trying to translate my Matlab code to Julia code, so I can use Julia as my main tool in teaching. I ran into an issue that I could not solve.

Below is my Matlab code:

```
clear all
m = 0; % mean
sd= 1; %std deviation
charfunc = @(v) exp(1i*m*v-0.5.*(sd^2).*(v.^2));
M=1/(2*pi);
X=3;
a=-100;
b=100;
func2 = @(v) exp(-1i.*v*X).*charfunc(v);
res1 = M*real(quad(func2,a,b))
res2 = normpdf(X,m,sd)
```

Below is my Julia code:

```
using QuantEcon, Distributions
m = 0 #mean
sd = 1 #standard deviation
function charfunc(v)
exp(im*m*v-0.5.*(sd^2).*(v.^2))
end
M = 1/(2*pi)
X = 3
a = -100
b = 100
function func2(v)
exp(-im.*v*X).*charfunc(v)
end
nodes, weights = qnwlege(65, a, b)
integral = do_quad(func2, nodes, weights) #integration between a and b
res1 = real(integral)*M
d = Normal(0,1)
res2 = pdf(d, X)
```

I expect res1 to be equal to res2. In my Julia code, I could not get the correct answer, but I am not sure where the bug is.