In you code, first you define L as followed:
Then, you redifine it to:
After that L is a scalar and not a vector. SO Next time MATLAB reached the line
Since L isn't a vector of 3 number but just 2*a it doesn't works.
Don't overwrite L and it will be fine