I have some problems following your code. I invite you to take the analytic approach to see if you get the same result. If you have the Symbolic Math Toolbox, try this:
syms w0 t w L real
h=w0*exp(-w0*t);
H1 = int(h * exp(-j*w*t), t, 0, 2*pi);
H2 = simplify(H1, 'steps', 10);
H3 = rewrite(H1, 'sincos');
ReH3 = simplify(real(H3), 'steps', 10)
ImH3 = simplify(imag(H3), 'steps', 10)
phas = simplify(atan(ImH3/ReH3), 'steps', 10)
fphas = matlabFunction(phas)
The last result is:
fphas = @(w,w0)atan((w.*cos(pi.*w.*2.0)-w.*exp(pi.*w0.*2.0)+w0.*sin(pi.*w.*2.0))./(-w0.*cos(pi.*w.*2.0)+w0.*exp(pi.*w0.*2.0)+w.*sin(pi.*w.*2.0)));
Plug in values for the respective variables and see what you get.
Best Answer