欢迎来到天天文库
浏览记录
ID:50115849
大小:169.14 KB
页数:10页
时间:2020-03-05
《【matlab编程代做】matlab实现bpsk+ofdm.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、%BPSKsimulationusingacarriercosinewavewithISIclc;closeall;clearall;%figure(1)n=160fori=1:ndata(i)=2*round(rand)-1;end%createmodulatedBPSKsignal%firstexpandthebitstreamexdata=[];fori=1:length(data)forrep=1:5exdata=[exdatadata(i)];endendts=.1;t=1:ts:80.9;ca
2、rrier=cos(pi*t);%multiplyexpandedbitstreambycosinewavewithcarrierfrequency%thisistheBPSKthatistobetransmittedoverthechannelbpsk=carrier.*exdata;%bpsk=[bpsk(length(bpsk)-1)bpsk(length(bpsk))bpsk];%plot(bpsk)%generatingthenoise%p=rand(1,800)*2*pi;p=rand*2*p
3、i;snr=10;r=sqrt(-1*(1/snr*log(1-rand)));%no=5*(r.*exp(j*p));no=(r.*exp(j*p));%valueofalphaal=rand+j*rand;%al=1;%Spreadingchannelwiththealphaasthevariablefork=5:5:795forl=1:5%al=round(rand)+j*round(rand)rec(k+l)=bpsk(k+l)+al*bpsk(k-5+l);endendrxdata=rec+no
4、;%begindemodulation%firstmultiplyrecievedbitstreambycosinewavewithcarrierfrequency%figure(2)uncarry=rxdata.*carrier;%plot(uncarry)%demodulatebyintegratingdec1=[];forinc=1:5:length(uncarry)dec=trapz(inc:inc+4,uncarry(inc:inc+4));dec1=[dec1dec];end%makedeci
5、sionwithathresholdofzerodemod=[];fori=1:length(dec1)ifdec1(i)>0demod=[demod1];elsedemod=[demod-1];endend%stem(demod)%calculateerrorserror=0;fori=1:length(demod)ifdata(i)~=demod(i)error=error+1;endenderrorber=error/nfigure(3)title('ComparingtheBitsattransm
6、itterandreceiver')stem(data)holdstem(demod,'rx')%VinayMohanJonnakuti%WirelessCommunication:%BPSKmodulationanddemodulationwithincreasedbitrate%BPSKsimulationusingacarriercosinewavewithincreasedbitrateclc;closeall;clearall;figure(1)n=320;fori=1:ndata(i)=2*r
7、ound(rand)-1;end%createmodulatedBPSKsignal%firstexpandthebitstreamexdata=[];fori=1:length(data)forrep=1:2exdata=[exdatadata(i)];endendexdata=data;ts=.1;t=1:ts:32.9;carrier=cos(pi*t);%multiplyexpandedbitstreambycosinewavewithcarrierfrequency%thisistheBPSKt
8、hatistobetransmittedoverthechannelbpsk=carrier.*exdata;%bpsk=[bpsk(length(bpsk)-1)bpsk(length(bpsk))bpsk];subplot(313)plot(bpsk)%generatingthenoise%p=rand(1,800)*2*pi;p=rand*2*pi;snr=10;r=sqrt(-1*(1/snr*log(1-rand))
此文档下载收益归作者所有