There are a few problems with this code. First is, I don't know what the curly braces are in there for, that's probably generating your error. You also aren't ending your for loop, and you're not storing your h for each iteration, only the last one. What is the problem you are trying to solve? It's possible you could solve it without the for loop by vectorizing the function.