I might not be understanding your question properly, but it looks like your code works just fine. Here is an example:
a = linspace(0,2*pi,1000);
fun = @(x) sin(a*x);
I made a a 1000 elements vector, then used your exact code to define fun, and used the new function with three different inputs. Works perfectly as you wrote it.