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

📄 qdpsk.m

📁 QDPSK Communication Performance simulation
💻 M
字号:
% MATLAB script for QDPSK Systemclear all;SNRindB1=0:2:12;for k=1:length(SNRindB1)	snr_in_dB = SNRindB1(k);	N=10000;	Es=1;				  	% energy per symbol	SNR=10^(snr_in_dB/10);	 	  	% signal to noise ratio	sgma=sqrt(Es/(4*SNR));	  	  	% noise variance	% generation of the data source follows	source = randint(2,N);	dsource = reshape(source,1,2*N);	% Differential encoding of the data source follows	mapping=[0 1 3 2];	M=4;	[diff_enc_output] = cm_dpske(Es,M,mapping,dsource).';	% received signals	n = sgma*[randn(1,N); randn(1,N)];	r = diff_enc_output + n;		% detection and the probability of error calculation	numoferr=0;	prev_theta=0;	for i=1:N,	  theta=angle(r(1,i)+j*r(2,i));	  delta_theta=mod(theta-prev_theta,2*pi);	  if ((delta_theta<pi/4) | (delta_theta>7*pi/4)),		decis(:,i)=[0 0].';	  elseif (delta_theta<3*pi/4),		decis(:,i)=[0 1].';	  elseif (delta_theta<5*pi/4)		decis(:,i)=[1 1].';	  else		decis(:,i)=[1 0].';	  end;	  prev_theta=theta;	end	% calculate the symbol error rate	numoferr = sum(sign(sum(decis~=source)));	smld_err_prb(k)=numoferr/N;endSNRindB2=0:0.1:12;for i=1:length(SNRindB2)  SNR=exp(SNRindB2(i)*log(10)/10);   	% signal to noise ratio  theo_err_prb(i)=2*Qfunct(sqrt(SNR)); 	% 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 + -