That is a scalar. Once that assignment is made, the variable cannot grow larger..
That uses all of Y, so b would be 1x21.
scalar plus scalar times vector times scalar gives vector right hand side. But you try to assign to summ which has been created as a scalar. When you are doing code generation, variables cannot grow unless you use special forms.
If you want a vector output then initialize summ to zeroes(size(Y)).
I suspect that you might have wanted to index Y in the loop