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

📄 pr2_46.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 2.46;
%Binary transmission error probability;
%Calculates error probability for an arbitrary signal pair versus SNR.
clear all; 
SP=[ones(1,100);ones(1,50),-ones(1,50);ones(1,70),-ones(1,30);zeros(1,100)]; %gives signal waveforms used further, one can add any wished signals;
S=[zeros(2,10),[SP(1,:);-SP(1,:)],zeros(2,10)]; %selects a pair of signals and appends front and end zeros to better visualize them;
N=size(S,2); E1=norm(S(1,:))^2; E2=norm(S(2,:))^2; %defines dimension and energies of signals;
subplot(121); plot(S');grid; xlabel('t'); ylabel('signals'); ylim([-1.2 1.2]); xlim([0,120]); %plotting signals
SNR=[1:0.1:5]; %SNR array;
x=(SNR.^2)*(1-2*(S(1,:)*S(2,:)')/(E1+E2))/2; %argument for error probability according to (2.16);
BER=erfc(sqrt(x/2))/2; %error probability (2.18);
subplot(122); plot(20*log10(SNR),log10(BER));grid; xlabel('SNR, dB'); ylabel('Error probability'); %plotting error probability;

⌨️ 快捷键说明

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