基于Matlab实现ASK、PSK、FSK 调制和 BER 与 SNR 计算附完整代码

简介: 基于Matlab实现ASK、PSK、FSK 调制和 BER 与 SNR 计算附完整代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测雷达通信 无线传感器

信号处理图像处理路径规划元胞自动机无人机 电力系统

⛄ 内容介绍

This paper mainly discusses about three basic digital modulation process ASK, FSK, PSK. These modulation schemes can be characterized by their transmitted symbols which consist of a discrete set of values occurring at gradually spaced intervals. The selection of a digital modulation technique for a specific application depend not only the bandwidth efficiency and implementation complexity but also error rate occurred in a bit (BER) and signal to noise ratio. Binary modulation methods use two level symbols and are facile to implement, provide good error substantiation. BER is a key parameter that used for assessing systems that transmit signal data from one location to another. SNR is well known measure of how the signal and noise power compare against each other. It directly affects the probability of error performance of a system. In this paper, we have implemented ASK, FSK and PSK using MATLAB.

⛄ 完整代码

clc

clear all

msglen=1000;

%msglen= number of bits to be transmitted

%take msglen=10000, or 20000 for more accuracy


%%===============================================

n=msglen;

b=randi(1,n);

f1=1;f2=2;

t=0:1/30:1-1/30;

%ASK

sa1=sin(2*pi*f1*t);

E1=sum(sa1.^2);

sa1=sa1/sqrt(E1); %unit energy

sa0=0*sin(2*pi*f1*t);

%FSK

sf0=sin(2*pi*f1*t);

E=sum(sf0.^2);

sf0=sf0/sqrt(E);

sf1=sin(2*pi*f2*t);

E=sum(sf1.^2);

sf1=sf1/sqrt(E);

%PSK

sp0=-sin(2*pi*f1*t)/sqrt(E1);

sp1=sin(2*pi*f1*t)/sqrt(E1);


%MODULATION

ask=[];psk=[];fsk=[];

for i=1:n

   if b(i)==1

       ask=[ask sa1];

       psk=[psk sp1];

       fsk=[fsk sf1];

   else

       ask=[ask sa0];

       psk=[psk sp0];

       fsk=[fsk sf0];

   end

end

figure(1)

subplot(411)

stairs(0:10,[b(1:10) b(10)],'linewidth',1.5)

axis([0 10 -0.5 1.5])

title('Message Bits');grid on

subplot(412)

tb=0:1/30:10-1/30;

plot(tb, ask(1:10*30),'b','linewidth',1.5)

title('ASK Modulation');grid on

subplot(413)

plot(tb, fsk(1:10*30),'r','linewidth',1.5)

title('FSK Modulation');grid on

subplot(414)

plot(tb, psk(1:10*30),'k','linewidth',1.5)

title('PSK Modulation');grid on

xlabel('Time');ylabel('Amplitude')

%AWGN

for snr=0:20

   askn=awgn(ask,snr);

   pskn=awgn(psk,snr);

   fskn=awgn(fsk,snr);


   %DETECTION

   A=[];F=[];P=[];

   for i=1:n

       %ASK Detection

       if sum(sa1.*askn(1+30*(i-1):30*i))>0.5

           A=[A 1];

       else

           A=[A 0];

       end

       %FSK Detection

       if sum(sf1.*fskn(1+30*(i-1):30*i))>0.5

           F=[F 1];

       else

           F=[F 0];

       end

       %PSK Detection

       if sum(sp1.*pskn(1+30*(i-1):30*i))>0

           P=[P 1];

       else

           P=[P 0];

       end

   end


   %BER

   errA=0;errF=0; errP=0;

   for i=1:n

       if A(i)==b(i)

           errA=errA;

       else

           errA=errA+1;

       end

       if F(i)==b(i)

           errF=errF;

       else

           errF=errF+1;

       end

       if P(i)==b(i)

           errP=errP;

       else

           errP=errP+1;

       end

   end

   BER_A(snr+1)=errA/n;

   BER_F(snr+1)=errF/n;

   BER_P(snr+1)=errP/n;

end


figure(2)

subplot(411)

stairs(0:10,[b(1:10) b(10)],'linewidth',1.5)

axis([0 10 -0.5 1.5]);grid on

title('Received signal after AWGN Channel')

subplot(412)

tb=0:1/30:10-1/30;

plot(tb, askn(1:10*30),'b','linewidth',1.5)

title('Received ASK signal');grid on

subplot(413)

plot(tb, fskn(1:10*30),'r','linewidth',1.5)

title('Received FSK signal');grid on

subplot(414)

plot(tb, pskn(1:10*30),'k','linewidth',1.5)

title('Received PSK signal');grid on

figure(3)

semilogy(0:20,BER_A, 'b','linewidth',2)

title('BER Vs SNR')

grid on;

hold on

semilogy(0:20,BER_F,'r','linewidth',2)

semilogy(0:20,BER_P, 'k','linewidth',2)

xlabel('Eo/No(dB)')

ylabel('BER')

hold off

legend('ASK','FSK','PSK');


⛄ 运行结果

⛄ 参考文献

[1] Bharati S ,  Rahman M A ,  Podder P . Implementation of ASK, FSK and PSK with BER vs. SNR comparison over AWGN channel[J].  2020.

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
数据可视化
基于MATLAB的OFDM调制发射与接收仿真
基于MATLAB的OFDM调制发射与接收仿真
|
边缘计算 资源调度 监控
无人机边缘计算中的计算卸载——Stackelberg博弈方法研究(Matlab代码实现)
无人机边缘计算中的计算卸载——Stackelberg博弈方法研究(Matlab代码实现)
621 3
|
Python
使用毕奥-萨伐尔定律计算圆形电流环的磁场,通过毕奥-萨伐尔定律,计算了圆形电流环的磁场(Matlab代码实现)
使用毕奥-萨伐尔定律计算圆形电流环的磁场,通过毕奥-萨伐尔定律,计算了圆形电流环的磁场(Matlab代码实现)
409 2
|
数据采集 数据可视化 前端开发
基于ARIMA电价预测,并计算置信区间研究(Matlab代码实现)
基于ARIMA电价预测,并计算置信区间研究(Matlab代码实现)
399 5
|
算法 机器人
基于SOA海鸥优化算法的PID控制器最优控制参数计算matlab仿真
本课题研究基于海鸥优化算法(SOA)优化PID控制器参数的方法,通过MATLAB仿真对比传统PID控制效果。利用SOA算法优化PID的kp、ki、kd参数,以积分绝对误差(IAE)为适应度函数,提升系统响应速度与稳定性。仿真结果表明,SOA优化的PID控制器在阶跃响应和误差控制方面均优于传统方法,具有更快的收敛速度和更强的全局寻优能力,适用于复杂系统的参数整定。
|
数据采集 算法 前端开发
MATLAB|基于3D FDTD的微带线馈矩形天线分析[用于模拟超宽带脉冲通过线馈矩形天线的传播,以计算微带结构的回波损耗参数]
MATLAB|基于3D FDTD的微带线馈矩形天线分析[用于模拟超宽带脉冲通过线馈矩形天线的传播,以计算微带结构的回波损耗参数]
507 2
|
算法
【电力系统潮流】5节点系统潮流计算-牛拉法和PQ分解法(Matlab代代码实现)
【电力系统潮流】5节点系统潮流计算-牛拉法和PQ分解法(Matlab代代码实现)
1180 3
|
Serverless Python
【三变量联合分布函数copula】利用AIC BIC确定单变量最优拟合函数、利用AIC确定三变量联合最优copula函数、计算联合概率(Matlab代码实现)
【三变量联合分布函数copula】利用AIC BIC确定单变量最优拟合函数、利用AIC确定三变量联合最优copula函数、计算联合概率(Matlab代码实现)
782 4
|
存储 编解码 并行计算
【快速傅里叶变换FFT、窗函数法、希尔伯特-黄变换、小波变换】电力系统同步相量计算研究(Matlab代码实现)
【快速傅里叶变换FFT、窗函数法、希尔伯特-黄变换、小波变换】电力系统同步相量计算研究(Matlab代码实现)
399 6
|
传感器 算法 数据可视化
MATLAB来计算和仿真无人机飞行过程
使用MATLAB来计算和仿真无人机飞行过程中的运动参数是一个极其常见且强大的方法。这通常被称为无人机建模与仿真,是无人机飞控算法开发中不可或缺的一环。
954 1

热门文章

最新文章