Use the debugger to find the problem. Type this in the command window:
Then run the code again until it stops at the error. Now split the command into parts and check them in the command window:
size(2 / l)
size((n * pi) / l)
size(sin((n * pi) / l) * x)
size(f .* sin((n * pi) / l) * x)
This method let you identify, which part causes the error message. This should help you to fix the problem.
It looks strange that you define n as vector at first and use it a loop index again. I guess you want to calculate the integrals inside the loop.