function ovsf_codes=ovsf_generator(spread_factor,code_number)
ovsf_codes=1;
if spread_factor==1
return;
end
for i=1:1:log2(spread_factor)
temp=ovsf_codes;
for j=1:1:size(ovsf_codes,1)
if j==1
ovsf_codes=[temp(j,:),temp(j,:); temp(j,:),(-1)*temp(j,:)];
else
ovsf_codes=[ovsf_codes; temp(j,:),temp(j,:); temp(j,:),(-1)*temp(j,:)];
end
end
end
if code_number>0
ovsf_codes=ovsf_codes(code_number,:);
end
end