⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bfsk.m

📁 A detail Matlab simulation code example for BFSK performance
💻 M
字号:
% MATLAB script for BFSK simulationclear all;SNRindB1=0:2:15;for k=1:length(SNRindB1)	snr_in_dB = SNRindB1(k);	% simulated error rate	N=10000;	Eb=1;	d=1;				  	snr=10^(snr_in_dB/10);	 	  	% signal to noise ratio per bit	sgma=sqrt(Eb/(2*snr));	  	  	% noise variance	phi=0;	% generation of the data source follows	dsource = randint(1,N);		% detection and the probability of error calculation	numoferr=0;	for i=1:N,	  % demodulator output	  if (dsource(i)==0),		r0c(i)=sqrt(Eb)*cos(phi)+sgma*randn;		r0s(i)=sqrt(Eb)*sin(phi)+sgma*randn;		r1c(i)=sgma*randn;		r1s(i)=sgma*randn;	  else		r0c(i)=sgma*randn;		r0s(i)=sgma*randn;		r1c(i)=sqrt(Eb)*cos(phi)+sgma*randn;		r1s(i)=sqrt(Eb)*sin(phi)+sgma*randn;	  end;	end	  % square law detector outputs	r0=r0c.^2+r0s.^2;    r1=r1c.^2+r1s.^2;	% decision is made next		for i=1:N		if (r0(i)>r1(i)),			decis(i)=0;		else			decis(i)=1;		end;	end	numoferr = sum(decis~=dsource);	smld_err_prb(k)=numoferr/(N);endSNRindB2=0:0.1:15;for i=1:length(SNRindB2)  SNR=exp(SNRindB2(i)*log(10)/10);     	% signal to noise ratio  theo_err_prb(i)=(1/2)*exp(-SNR/2);	% theoretical symbol error rateend% Plotting commands followsemilogy(SNRindB1,smld_err_prb,'*');holdsemilogy(SNRindB2,theo_err_prb);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -