There seem to be two problems:
1) your function "fun" returns "NaN" at zero, so you cannot integrate starting from zero. You need to start from some non-zero value
2) I still get an error due to the integral function not being able to satify the tolerance. use the 'Relto' argument to reduce the tolerance, e.g.
xstart = 0.1;
D = integral(fun,xstart,w_max,'Relto',1e-3);
The problem I am seeing now is that the function is basically infinite at zero, therefore the integral value is highly dependent on the starting value. But the smaller you make the starting value, the larger you must make the Reltol in order to get a solution, so the numerical process is inherently limited.