Using epsi as both the name of an anonymous function, and the dummy parameter of a different anonymous function, is asking or trouble (IMHO.)
quad is going to call your xyz routine and pass it in a vector argument as the first parameter, and expect a vector argument as output.
Your xyz routine will use espi just as the name of the dummy parameter, so within xyz, "espi" is the vector of x values passed to xyz. sqrt() of that vector is well defined and returns a vector of the same length [as the vector of x values passed to xyz]. But then in the denominator, you have 1+exp(espi-n) . We know the size of espi (the number of values passed to xyz), but what is the size of n? By looking two lines above that, we can see that n will depend upon the size of EF, and by looking at the line above that, we know that EF will have the length 1000; popping up, we know that the "n" in expi-n will have length 1000. But is the length of espi 1000 ? Probably not, so the subtraction will likely not work.
