I’ve read the code file ./+Parameters/getCodebook_5G.m (Simulator v1.2) and compared it with the TS 38.214-f10. I found that there may be some little mistakes.
On line 165, maybe theta = @(p) exp(1i*pi/4); should be changed to theta = @(p) exp(1i*pi*p/4);
On line 275, according to the specification, for i11 = 0:(N1*O1-1) is going to be modified to for i11 = 0:(N1*O1/2-1)
On line 295 to 308, maybe should classify and discuss N1 and N2, because when N1>2, N2=1, the subscript l” of W is i11+2*O1 rather than i11+O1, and the subscript m” should be 0 rather than 0+O2
On line 310 to 324, the 6 layers part, the same to line 295 to 308.
If the above wasn’t my mistakes of thinking, you may leave an email that I can send the adjusted code to you. Or you may contact me by sending message to firstname.lastname@example.org.