function B1C = BDS_B1C(N,N0,tap1,tap2)
%% 生成北斗B1C 导频or数据分量主码
% 设置N N0 可生成B2a导频分量的子码
% N 勒让德序列N, N0数据长度
% for B1C :
% N = 10243; N0 = 10230
% for B1C pilot sub code :
% N = 3607; N0 = 1800
% for B2a pilot sub code
% N = 1021; N0 = 100
% tap1 w; tap2 p
% B1C 高低电平模式输出 1~-1 0~1
N = 10243;
legend = legendreSquence(N);
G1 = [legend legend];
% weil length = 10243
weil = zeros(1,N);
for i=1:N
weil(i) = xor(G1(i),G1(i+tap1));
end
weil = [weil weil];
% B1C length = 10230
B1C = weil(tap2:tap2+N0-1);
% convert to -1 1.
for i=1:size(B1C,2)
if B1C(i)==1
B1C(i)=-1;
else
B1C(i)=1;
end
end
%% 生成北斗B1C 导频or数据分量主码
% 设置N N0 可生成B2a导频分量的子码
% N 勒让德序列N, N0数据长度
% for B1C :
% N = 10243; N0 = 10230
% for B1C pilot sub code :
% N = 3607; N0 = 1800
% for B2a pilot sub code
% N = 1021; N0 = 100
% tap1 w; tap2 p
% B1C 高低电平模式输出 1~-1 0~1
N = 10243;
legend = legendreSquence(N);
G1 = [legend legend];
% weil length = 10243
weil = zeros(1,N);
for i=1:N
weil(i) = xor(G1(i),G1(i+tap1));
end
weil = [weil weil];
% B1C length = 10230
B1C = weil(tap2:tap2+N0-1);
% convert to -1 1.
for i=1:size(B1C,2)
if B1C(i)==1
B1C(i)=-1;
else
B1C(i)=1;
end
end