2fsk基于matlab的仿真,基于matlab的2ask、2psk、2fsk的仿真

MATLAB

一、

t=0:1/1e3:0.999;

a=randint(1,10,2);

g=ones(1,100);

g=[g,g,g,g,g,g,g,g,g,g];

s=a(ceil(10*t+0.01)).*g.*cos(2*pi*100*t);

subplot(2,1,1);

plot(t,a(ceil(10*t+0.01)));

axis([0,1,0,1.2]);

subplot(2,1,2);

plot(t,s);

二、

t=0:1/1e3:0.999;

df=10;

a=randint(1,10,2);

m=2*a(ceil(10*t+0.01))-1;

s=cos(2*pi*(100+m*df).*t);

f=1000*(0:256)/512;

S=fft(s,512);

Pss=S.*conj(S)/512;

subplot(3,1,1);

plot(t,a(ceil(10*t+0.01)));

axis([0,1,0,1.2]);

subplot(3,1,2);

plot(t,s);

subplot(3,1,3);

plot(f,Pss(1:257));

三、

M=2;

t=0:0.001:0.999;

m=randint(10,1,M)';

m=m(ceil(10*t+0.01));

s=cos(2*pi*100*t+m/M);

f=1000*(0:256)/512;

S=fft(s,512);

Pss=S.*conj(S)/512;

subplot(3,1,1);

plot(t,m);

axis([0,1,min(m)-0.2,max(m)+0.2]);

subplot(3,1,2);

plot(t,s);

subplot(3,1,3);

plot(f,Pss(1:257));

四、

%- 2DPSK 调制与解调

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

%>>>>>>>>>>>>>>>>>>Initial_Part>>>>>>>>>>>>>>>>>>>>>

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

function y=dpsk2()

fs = 30000;

Time_Hold_On = 0.1;

Num_Unit = fs * Time_Hold_On;

High_Level = ones ( 1, Num_Unit );

Low_Level = zeros ( 1, Num_Unit );

w = 300;

A = 1;

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

%>>>>>>>>>>>>>>>>>>Initial_The_Signal>>>>>>>>>>>>>>>

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

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

Lenth_Of_Sign = length ( Sign_Set );

st = zeros ( 1, Num_Unit * Lenth_Of_Sign );

sign_orign = zeros ( 1, Num_Unit * Lenth_Of_Sign );

sign_result = zeros ( 1, Num_Unit * Lenth_Of_Sign );

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

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

%>>>>>>>>>>>Generate_The_Original_Signal>>>>>>>>>>>>

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

for I = 1 : Lenth_Of_Sign

if Sign_Set(I) == 1

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

else

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

end

end

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

%>>>>>>>>>>>>>>>>>>Modulation_Part>>>>>>>>>>>>>>>>>>

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

for I = 1 : Lenth_Of_Sign

if Sign_Set(I) == 1

st( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w * t( (I-1)*Num_Unit + 1 : I*Num_Unit ) + ( pi / 2 ) );

else

st( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w * 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), A + (A / 2) ] );

title ( '原始信号' );

grid

subplot ( 2, 1, 2 );

plot ( t, st );

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

title ( '调制后的信号' );

grid

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

%>>>>>>>>>>>>>>>>>>相乘>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

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

dt = st .* cos ( 2 * pi * w * t );

figure

subplot(2,1,1)

plot ( t, dt );

axis(

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值