4FSK调制和解调

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

%--------------------------------------------------- %>>>>>>>>>>>>>>>>>>初始化数据>>>>>>>>>>>>>>>>>>>>>

%---------------------------------------------------

clc,clear,close all;

fs = 30000;

Time_Hold_On = 0.1;

Num_Unit = fs * Time_Hold_On;

one_Level = zeros ( 1, Num_Unit );

two_Level = ones ( 1, Num_Unit );

three_Level = 2*ones ( 1, Num_Unit );

four_Level = 3*ones ( 1, Num_Unit );

A = 1; % the default ampilitude is 1 w1 = 300; %初始化载波频率

w2 = 600;

w3=900;

w4=1200;

%--------------------------------------------------- %>>>>>>>>>>>>>>>>>>串并转换>>>>>>>>>>>>>>>

%---------------------------------------------------

Sign_Set=[0,0,1,1,0,1,1,0,1,0,1,0,1,0,0,1]

Lenth_Of_Sign_Set = length ( Sign_Set ); %计算信号长度

j=1;

for I=1:2:Lenth_Of_Sign_Set %信号分离成两路信号Sign_Set1(j)= Sign_Set(I);Sign_Set2(j)=Sign_Set(I+1);

j=j+1;

end

Lenth_Of_Sign = length ( Sign_Set1 );

st = zeros ( 1, Num_Unit * Lenth_Of_Sign/2 );

sign_orign = zeros ( 1, Num_Unit * Lenth_Of_Sign/2 );

sign_result = zeros ( 1, Num_Unit * Lenth_Of_Sign/2 );

t = 0 : 1/fs : Time_Hold_On * Lenth_Of_Sign- 1/fs;

%---------------------------------------------------

%>>>>>>>>>>>产生基带信号>>>>>>>>>>>>

%---------------------------------------------------

for I = 1 : Lenth_Of_Sign

if ((Sign_Set1(I) == 0)&(Sign_Set2(I) == 0)) %00为1电平sign_orign( (I-1)*Num_Unit + 1 : I*Num_Unit) = one_Level;

elseif ((Sign_Set1(I) == 0)&(Sign_Set2(I) == 1)) %01为2电平sign_orign( (I-1)*Num_Unit + 1 : I*Num_Unit) = two_Level;

elseif ((Sign_Set1(I) == 1)&(Sign_Set2(I) == 1)) %11为3电平

sign_orign( (I-1)*Num_Unit + 1 : I*Num_Unit) = three_Level;

else %10为4电平sign_orign( (I-1)*Num_Unit + 1 : I*Num_Unit) = four_Level;

end

end

%---------------------------------------------------

%>>>>>>>>>>>>>>>>>>产生频带信号>>>>>>>>>>>>>>>>>>

%---------------------------------------------------

for I = 1 : Lenth_Of_Sign

if ((Sign_Set1(I) == 0)&(Sign_Set2(I) == 0)) %00为载波w1 st((I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w1 * t( (I-1)*Num_Unit + 1 : I*Num_Unit ) );

elseif ((Sign_Set1(I) == 0)&(Sign_Set2(I) == 1)) %01为载波w2 st( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w2 * t((I-1)*Num_Unit + 1 : I*Num_Unit ) );

elseif ((Sign_Set1(I) == 1)&(Sign_Set2(I) == 1)) %11为载波w3 st( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w3 * t((I-1)*Num_Unit + 1 : I*Num_Unit ) );

else %10为载波w4 st( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w4 * t( (I-1)*Num_Unit + 1 :I*Num_Unit ) );

end

end

%---------------------------------------------------

%>>>>>>>>>>>>>>>画初始信号图>>>>>>>>>>>>>>>>>

%---------------------------------------------------

figure

subplot ( 2, 1, 1 )

plot ( t, sign_orign );

axis( [ 0 , Time_Hold_On *( Lenth_Of_Sign + 1),-A/2, 3*A+A/2] );

title ( 'The original Signal' );

grid;

subplot ( 2, 1, 2 )

plot ( t, st ); % the signal after modulation

axis( [ 0 , Time_Hold_On *( Lenth_Of_Sign + 1), -A, A ] );

title ( 'the signal after modulation' );

grid;

%---------------------------------------------------

%>>>>>>>>>>>>>>>带通滤波器>>>>>>>>>>>>>>

%---------------------------------------------------

相关文档
最新文档