资源预览内容
第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
亲,该文档总共5页全部预览完了,如果喜欢就下载吧!
资源描述
%- 2DPSK 调制与解调%-%参数初始化%-fs = 3600000;%采样频率为 36000 赫兹Time_Hold_On = 1/1200;%一个时钟周期为 1200 分之 1,对应比特率为 1200bps Num_Unit = fs * Time_Hold_On;%一个时钟周期内的采样点个数High_Level = ones ( 1, Num_Unit );%高电平(全 1 序列) Low_Level = zeros ( 1, Num_Unit );%低电平(全 0 序列) w = 1800;%载波角频率 1800HzA = 1;%载波幅值%-%信号初始化%-Sign_Set = 0,1,1,0,1,0,0,1;%原始序列Lenth_Of_Sign = length ( Sign_Set );%原始序列长度Sign_Sett = ones(1,Lenth_Of_Sign+1);%差分变换后的序列,初始化为长度为原始序列长度+1 的全 1 序列(第一个码元为 1)sign_orign = zeros ( 1, Num_Unit * (Lenth_Of_Sign+1) );%初始化基带信号为全 0 序列sign_result = zeros ( 1, Num_Unit * (Lenth_Of_Sign+1) );%初始化接收到的基带信号为全 0 序列st = zeros ( 1, Num_Unit *( Lenth_Of_Sign+1) );%初始化调制后的信号为全 0 序列t = 0 : 1/fs : Time_Hold_On * (Lenth_Of_Sign +1)- 1/fs;%信号采样时间点result=zeros(1,Lenth_Of_Sign+1);%初始化接收到的序列resultt=zeros(1,Lenth_Of_Sign);%初始化差分解调后的序列%-%求差分编码%-for I = 2 : Lenth_Of_Sign+1%差分变换后的序列第一个值为 1,从第 2 个开始计算Sign_Sett(I)= xor(Sign_Sett(I-1),Sign_Set(I-1);%用异或运算求差分码end%-%产生基带信号%-for I = 1 : Lenth_Of_Sign+1%考虑差分变换后序列中每一个值if Sign_Sett(I) = 1sign_orign( (I-1)*Num_Unit + 1 : I*Num_Unit) = High_Level;%序列值为 1,基带信号为高电平elsesign_orign( (I-1)*Num_Unit + 1 : I*Num_Unit) = Low_Level;%序列值为 0,基带信号为低电平endend%-%调制部分%-for I = 1 : Lenth_Of_Sign+1%考虑差分变换后序列中每一个值if Sign_Sett(I) = 1st( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w * t( (I-1)*Num_Unit + 1 :I*Num_Unit ) + ( pi / 2 ) );%序列值为 1,相位调制为 /2 elsest( (I-1)*Num_Unit + 1 : I*Num_Unit) = A * cos ( 2 * pi * w * t( (I-1)*Num_Unit + 1 :I*Num_Unit ) );%序列值为 0,相位调制为 0 endendfiguresubplot ( 2,1,1 ) plot(t, sign_orign);axis( 0 , Time_Hold_On *( Lenth_Of_Sign + 2), - (A / 2), A + (A / 2) ); title ( 原始信号 );grid%画出基带信号subplot ( 2, 1, 2 );plot ( t, st );axis( 0 , Time_Hold_On *( Lenth_Of_Sign + 2), - 3*(A / 2), 3*(A / 2) ); title ( 调制后的信号 );grid%画出相位调制后的信号%-%相干解调%-dt= st .* cos ( 2 * pi * w * t ); %相干相乘figureplot ( t, dt );axis( 0 , Time_Hold_On *( Lenth_Of_Sign + 2), - 3*(A / 2), 3*(A / 2) ); title ( 相干相乘后的波形 );grid%-%低通滤波部分%-N,Wn = buttord( 2*pi*1500, 2*pi*3400,3,25,s); %临界频率采用角频率表示,计算低通滤波器参数b,a=butter(N,Wn,s); %产生 N 阶低通巴特沃斯滤波器bz,az=impinvar(b,a,fs); %映射为数字的dt = filter(bz,az,dt); %将相干相乘后的信号进行滤波figureplot ( t, dt );axis( 0 , Time_Hold_On *( Lenth_Of_Sign + 2), - 3*(A / 2), 3*(A / 2) ); title ( 低通滤波后的波形 );grid%-%抽样判决 & 逆码变换部分%-for I = 1 : Lenth_Of_Sign+1if dt(2*I-1)*Num_Unit/2) 序列生成与差分还原%-for I=1: Lenth_Of_Sign+1result(I)=sign_result(I* Num_Unit)%将接收到的信号生成(差分)序列endfor I = 1 : Lenth_Of_Signresultt(I)= xor(result(I),result(I+1) %将接收到的差分序列还原为原序列endwindow=boxcar(length(st); %矩形窗nfft=1024;Pxx,f=periodogram(st,window,nfft,fs); %求功率谱密度plot(f,10*log10(Pxx);“”“”At the end, Xiao Bian gives you a passage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous learning can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edite
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号