?? cp0201_transmitter_2ppm_th.m
字號:
function [bits,THcode,Stx,ref]=cp0201_transmitter_2PPM_TH
Pow = -30;
fc = 50e9;
numbits = 2;
Ts = 3e-9;
Ns = 5;
Tc = 1e-9;
Nh = 3;
Np = 5;
Tm = 0.5e-9;
tau = 0.25e-9;
dPPM = 0.5e-9;
G = 1;
bits = cp0201_bits(numbits);
repbits = cp0201_repcode(bits,Ns);
THcode = cp0201_TH(Nh,Np);
[PPMTHseq,THseq] = ...
cp0201_2PPM_TH(repbits,fc,Tc,Ts,dPPM,THcode);
power = (10^(Pow/10))/1000;
Ex = power * Ts;
w0 = cp0201_waveform(fc,Tm,tau);
wtx = w0 .* sqrt(Ex);
Sa = conv(PPMTHseq,wtx);
Sb = conv(THseq,wtx);
L = (floor(Ts*fc))*Ns*numbits;
Stx = Sa(1:L);
ref = Sb(1:L);
if G
F = figure(1);
set(F,'Position',[32 223 951 420]);
tmax = numbits*Ns*Ts;
time = linspace(0,tmax,length(Stx));
P = plot(time,Stx);
set(P,'LineWidth',[2]);
ylow=-1.5*abs(min(wtx));
yhigh=1.5*max(wtx);
axis([0 tmax ylow yhigh]);
AX=gca;
set(AX,'FontSize',12);
X=xlabel('Time [s]');
set(X,'FontSize',14);
Y=ylabel('Amplitude [V]');
set(Y,'FontSize',14);
for j = 1 : numbits
tj = (j-1)*Ns*Ts;
L1=line([tj tj],[ylow yhigh]);
set(L1,'Color',[0 0 0],'LineStyle', ...
'--','LineWidth',[2]);
for k = 0 : Ns-1
if k > 0
tn = tj + k*Nh*Tc;
L2=line([tn tn],[ylow yhigh]);
set(L2,'Color',[0.5 0.5 0.5],'LineStyle', ...
'-.','LineWidth',[2]);
end
for q = 1 : Nh-1
th = tj + k*Nh*Tc + q*Tc;
L3=line([th th],[0.8*ylow 0.8*yhigh]);
set(L3,'Color',[0 0 0],'LineStyle', ...
':','LineWidth',[1]);
end
end
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -