【正文】
ho off。end。echo on。for i=1:length(SNRindB2), SNR=exp(SNRindB2(i)*log(10)/10)。 % signaltonoise ratio theo_err_prb(i)=Qfunct(sqrt(SNR/2))。 % theoretical error rate echo off。end。echo on。% Plotting mands follow.semilogy(SNRindB1,smld_err_prb,39。*39。)。holdsemilogy(SNRindB2,theo_err_prb)。某二進(jìn)制系統(tǒng)采用FSK。假定一個(gè)碼元的能量為。請(qǐng)計(jì)算判決條件、繪制蒙特卡洛仿真原理框圖并編制matlab程序。答:設(shè)0對(duì)應(yīng)f1信號(hào),1對(duì)應(yīng)f2信號(hào),判決條件是當(dāng)檢測(cè)器輸入為(E,0)()時(shí),輸出為1。假設(shè)f1=1000/Tb% MATLAB script for Illustrative Problem . echo onTb=1。f1=1000/Tb。f2=f1+1/Tb。phi=pi/4。N=5000。 % number of samplest=0:Tb/(N1):Tb。u1=cos(2*pi*f1*t)。u2=cos(2*pi*f2*t)。% Assuming that u1 is transmitted, the received signal r issgma=1。 % noise variancefor i=1:N, r(i)=cos(2*pi*f1*t(i)+phi)+gngauss(sgma)。 echo off。end。echo on 。% The correlator outputs are puted next.v1=sin(2*pi*f1*t)。v2=sin(2*pi*f2*t)。r1c(1)=r(1)*u1(1)。r1s(1)=r(1)*v1(1)。r2c(1)=r(1)*u2(1)。r2s(1)=r(1)*v2(1)。for k=2:N, r1c(k)=r1c(k1)+r(k)*u1(k)。 r1s(k)=r1s(k1)+r(k)*v1(k)。 r2c(k)=r2c(k1)+r(k)*u2(k)。 r2s(k)=r2s(k1)+r(k)*v2(k)。 echo off。end。echo on。% decision variablesr1=r1c(5000)^2+r1s(5000)^2。r2=r2c(5000)^2+r2s(5000)^2。% Plotting mands follow.7 / 7