📄 bask1.m
字号:
% bask1.m
%
% Simulation program to realize BASK transmission system
% 没有过采样的
% Programmed by snowflier,
%
%******************** basic information of the signal **********************
T=1 % time duration
delta_T=T/200; % the interval of the signal
alpha=0.5; % rolloff factor
fc=40/T; % carrier frequency
t=-5*T+delta_T:delta_T:5*T; % time
N=length(t); % Number of signals
%******************** Data generation ********************************
data=rand(1,N)>0.5; % rand: built in function
data=data.*2-1;
%******************* Filter initialization ********************
for i=1:N
if(abs(t(i))~=T/(2*alpha)),
g_T(i)=sinc(t(i)/T)*(cos(pi*alpha*t(i)/T)/(1-4*alpha^2*t(i)^2/T^2));
else
g_T(i)=0;
end;
end;
data1=conv(data,g_T);
%********************modulation********************************
delta_T1=1/length(data1);
t1=delta_T1:delta_T1:T;
bask=data1.*cos(2*pi*fc*t1);
figure(1)
subplot(211)
plot(t,g_T)
subplot(212)
plot(t1,bask);
%*******************spectrem**********************************
G_T=abs(fft(g_T));
Bask=abs(fft(bask));
f=-0.5/delta_T:1/(delta_T*(N-1)):0.5/delta_T;
f1=-0.5/delta_T1:1/(delta_T1*(length(data1)-1)):0.5/delta_T1;
figure(2)
subplot(211)
plot(f,fftshift(G_T))
subplot(212)
plot(f1,fftshift(Bask));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -