%P1test
function [I]=p1(L,A,fc,T,B,LL)%脉冲宽度T=N(码元数,码长)*td(码元宽度),等效带宽B=1/td=N/T,
M=LL*LL;
% Td=1/B;%子码宽度
Td=T/M; %子码宽度
nn=L/M; %子码采样点数
fs =nn/Td; % Sample Rate
% fs=L/T %采样率 7000MHz
tb=1/(fs); % Sampling period
t_tao=0:1/fs:Td-1/fs;
t=0:1/fs:T-1/fs;
for i=1:LL
for m=1:LL
a(i,m)=-(pi/LL)*(LL-(2*m-1))*(LL*(m-1)+(i-1));
end
end
b=a(1,:);
for i=2:LL
b=[b a(i,:)];
end
length(b);
length(t);
length(t_tao);
% index=0;
for k=1:M
% for n=1:nn %Loop to increment time for single phase value.
I(1,(k-1)*length(t_tao)+1:k*length(t_tao))=A*exp(1j*(2*pi*fc*t_tao+b(k))); %Calculate in phase component of signal with phase shift
IWO(1,(k-1)*length(t_tao)+1:k*length(t_tao))=A*exp(1j*(2*pi*fc*t_tao)); % Calculate in phase component of signal without phase shift
% I(index+1)=A*cos(2*pi*fc*(n-1)*tb+b(k)); %Calculate in phase component of signal with phase shift
% IWO(index+1)=A*cos(2*pi*fc*(n-1)*tb); % Calculate in phase component of signal without phase shift
% time(index+1)=index*tb; %time vector cumulation
% index = index +1;
% end
end
% nn
% length(I)
% figure(1)
% subplot(311)
% plot(I)
% subplot(312)
% plot(IWO)
% subplot(313)
% plot(t)
%
%
% figure(2)
% plot(a);
% title(['P1码相移']);
% xlabel('i - 相移指数');
% ylabel('相移 - Theta');
% grid on;
评论0