The error is here
x = (a + (i-1).*h)';
alphax = alpha(x);
You're indexing alpha using vector x. As the error indicates, indices need to be positive integers. Instead, x equals
. . .
Also, the alpha input is just 1 so why why would that be indexed in the first place?
Lastly, your last two inputs don't appear in your function so they aren't doing anything.