亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qpsk.m

?? qpsk信號的仿真程序!包括時頻域的表示及圖表說明
?? M
字號:
%QPSK Transmitter and I-Q Correlation Receiver
%JC 12/23/05-revised 2/14/06
%Run from editor debug(F5)
%m-file for simulating a QPSK transmitter and receiver by modulating with a pseudo
%random bit stream. A serial to parallel conversion of the pseudo random
%bit stream is performed with mapping of two bits per symbol(phase). A cosine and
%sine carrier is configured and the I and Q symbols modulate these
%carriers via mixers. The I and Q carriers are combined and time and frequency domain
%plots are provided showing key waveforms at various positions in the QPSK
%transmitter and correlation receiver. A parallel to serial conversion is used on the
%output of the receiver. The simulation uses a serial "passband" approach.
%In  other words a carrier is used. Notes are provided at the end of the m-file.
%===================================================================
clear;
fcarr=5e3;         % Carrier frequency(Hz)
N=8;		        % Number of data bits(bit rate)
fs=20*1e3;		    % Sampling frequency
Fn=fs/2;            % Nyquist frequency
Ts=1/fs;	        % Sampling time = 1/fs
T=1/N;		        % Bit time
randn('state',0);   % Keeps PRBS from changing on reruns
td=[0:Ts:(N*T)-Ts]';% Time vector(data)(transpose)
%===================================================================
% The Transmitter.
%===================================================================
data=sign(randn(N,1))';%transpose
data1=ones(T/Ts,1)*data;
data2=data1(:);

%display input data bits in command window
data_2=data2';%transpose
data_2=data_2 >0;
Transmitted_data_bits=data_2(1:(fs)/N:end)

%Serial to parallel (alternating)
tiq = [0:Ts*2:(N*T)-Ts]';% Time vector for I and Q symbols(transpose)

bs1=data(1:2:length(data));%odd
symbols=ones(T/Ts,1)*bs1;
Isymbols=symbols(:);%I_waveform

bs2=data(2:2:length(data));%even
symbols1=ones(T/Ts,1)*bs2;
Qsymbols=symbols1(:);%Q_waveform

%generate carrier waves
%cosine and sine wave
%2 pi fc t is written as below
twopi_fc_t=(1:fs/2)*2*pi*fcarr/fs; 
a=1;
%phi=45*(pi/180)
phi=0;%phase error
cs_t = a * cos(twopi_fc_t + phi);
sn_t = a * sin(twopi_fc_t + phi);

cs_t=cs_t';%transpose
sn_t=sn_t';%transpose
si=cs_t.*Isymbols;%multiply I bitstream with cosine
sq=sn_t.*Qsymbols;%multiply Q bitstream with sine
sumiq=si+sq;%transmitter output
sumiq=.7*sumiq;%reduce gain to keep output at +/- one 

%=============================================================
%Noise
%=============================================================

noise=randn(size(sumiq));
SNR=10%set SNR in dB
constant=std(sumiq)/(std(noise)*10^(SNR/20));
sumiq=sumiq + noise*constant;
noise1=noise*constant;

%=============================================================
%Receiver(balanced modulators and low pass filters) 
%=============================================================
sig_rx1=sumiq.*cs_t;%cosine 
sig_rx1=.707.*sig_rx1;%keep output at 1Vp-p

%simple low pass filter
rc1=.01989316;%time constant
ht1=(1/rc1).*exp(-tiq/rc1);%impulse response
ycfo1=filter(sig_rx1,1,ht1)/fs;
Bit_rate=N
IFilterfreg_3dB=1/(2*pi*rc1)


sig_rx=sumiq.*sn_t;%sine
sig_rx=.707.*sig_rx;%keep output at 1Vp-p

%simple low pass filter
rc=.01989316;%time constant-
ht=(1/rc).*exp(-tiq/rc);%impulse response
ycfo=filter(sig_rx,1,ht)/fs;
Bit_rate=N
QFilterfreg_3dB=1/(2*pi*rc)
%=========================================================
% I CORRELATION RECEIVER COMPARATOR[ADC](after low pass filter)
%=========================================================
pt1=1.7e-8;%sets level where threshhold device comparator triggers
H=5;%(volts)
L=0;%(volts)
LEN=length(ycfo);
for ii=1:LEN;
    if ycfo(ii)>=pt1;%correlated output(ycfo) going above pt1 threshold setting
        pv1i(ii)=H;%I pulse voltage
    else;
        pv1i(ii)=L;
    end;
end ;
po1i=pv1i;%pulse out=pulse voltage


%=========================================================
% Q CORRELATION RECEIVER COMPARATOR[ADC](after low pass filter)
%=========================================================
pt2=1.7e-8;%sets level where threshhold device comparator triggers
H=5;%(volts)
L=0;%(volts)
LEN=length(ycfo1);
for ii=1:LEN;
    if ycfo1(ii)>=pt2;%correlated output(ycfo1) going above pt2 threshold setting
        pv2q(ii)=H;% Q pulse voltage
    else;
        pv2q(ii)=L;
    end;
end ;
po1q=pv2q;%pulse out=pulse voltage


bit1=sign(po1q);%0 and 1
bit2=sign(po1i);%0 and 1
bit3=bit1 >0;%0 and 1
bit4=bit2 >0;%0 and 1
bitout=[bit3];
bitout1=[bit4];
%==========================================================================
%Parallel to serial bitstream(uses interleaving and concatenation{joining})
%==========================================================================
    
bitout2=[bitout];
x=1128;%x=fs/N;%This is a cluge way to program but x is required to make the parallel
%to serial converter work if one changes the basic parameters such as N,fs,etc.
%x=N*(bit3 # 1's or 0's in first bit time)-fs:x=(8*2641)-20000=1128
bitout2=bitout2(1:(fs+x)/N:end);
bitout2=[bitout2];
bitout3=[bitout1];
bitout3=bitout3(1:(fs+x)/N:end);
bitout3=[bitout3];
bitfinalout=[bitout2;bitout3];
bitfinalout=bitfinalout(1:end);

%display received output data bits in command window
Received_data_bits=bitfinalout

%Received data output
data1a=ones(T/Ts,1)*bitfinalout;
bitfinal1=data1a(:);
bitfinal1=bitfinal1-mean(bitfinal1);
bitfinal1=2*bitfinal1;%get to +/- 1

%=====================================================================
%Plots
%======================================================================
figure(1)
subplot(3,2,1)
plot(td,data2)
axis([0 1 -2 2]);
grid on
xlabel('                                                          Time')
ylabel('Amplitude')
title('Input Data')

subplot(3,2,3)
plot(tiq,Isymbols)
axis([0 1 -2 2]);
grid on
xlabel('                                                          Time')
ylabel('Amplitude')
title('I Channel(one bit/symbol(phase)) Data')

subplot(3,2,5)
plot(tiq,Qsymbols)
axis([0 1 -2 2]);
grid on
xlabel('                                                          Time')
ylabel('Amplitude')
title('Q Channel(one bit/symbol(phase)) Data')

subplot(3,2,2)
plot(tiq,si)
axis([.498 .502 -2 2]);
grid on
xlabel('                                                          Time')
ylabel('Amplitude')
title('I Channel Modulated Waveform')

subplot(3,2,4)
plot(tiq,sq)
axis([.498 .502 -2 2]);
grid on
xlabel('                                                          Time')
ylabel('Amplitude')
title('Q Channel Modulated Waveform')

subplot(3,2,6)
plot(tiq,sumiq)
axis([.498 .502 -2 2]);
grid on
xlabel('                                                          Time')
ylabel('Amplitude')
title('QPSK Output Waveform')


%========================================================================
%Take FFT of modulated carrier
%========================================================================
y=sumiq;
NFFY=2.^(ceil(log(length(y))/log(2)));
FFTY=fft(y,NFFY);%pad with zeros
NumUniquePts=ceil((NFFY+1)/2); 
FFTY=FFTY(1:NumUniquePts);
MY=abs(FFTY);
MY=MY*2;
MY(1)=MY(1)/2;
MY(length(MY))=MY(length(MY))/2;
MY=MY/length(y);
f1=(0:NumUniquePts-1)*2*Fn/NFFY;
%=========================================================================
%Plot frequency domain
%=========================================================================
figure(2)
subplot(3,1,1); plot(f1,MY);xlabel('');ylabel('AMPLITUDE');
axis([4500 5500 -.5 1]);%zoom in/out
title('Frequency domain plots');
grid on

subplot(3,1,2); plot(f1,20*log10(abs(MY).^2));xlabel('FREQUENCY(Hz)');ylabel('DB');
axis([4000 6000 -80 10]);%zoom in/out
grid on
title('Modulated QPSK carrier')


figure(3)
subplot(3,2,1);
plot(td,bitfinal1)
title('Received output data');
grid on;
axis([0 1 -2 2]);

subplot(3,2,3);
plot(tiq,ycfo1);
title('Filtered I Channel Data');
grid on;

subplot(3,2,5);
plot(tiq,ycfo);
title('Filtered Q Channel Data');
grid on;

subplot(3,2,2);
plot(tiq,sig_rx1);
grid on;
axis([0 1 -1 1]);%zoom in/out
title('Unfiltered I Channel Output');


subplot(3,2,4);
plot(tiq,sig_rx);
grid on;
axis([0 1 -1 1]);%zoom in/out
title('Unfiltered Q Channel Output');

phasevl=atan2(ycfo1,ycfo);%phases of transmitter output
                          %phase deviation---(-2.355 radians)=-135 degrees(-1-1)
                          %phase deviation---(+0.785 radians)=+45 degrees(1 1)                          %1)
                          %phase deviation---(-0.785 radians)=-45 degrees(-1 1)
                          %phase deviation---(+2.355 radians)=+135 degrees(1-1)
subplot(3,2,6);
plot(tiq,phasevl);
grid on;
title('Output phase deviation(radians) levels')
xlabel('   Time')
ylabel('Radians')

figure(4);
subplot(4,2,1);
plot(tiq,noise1);%plot noise times a constant
grid on;
title('Noise output')
xlabel('   Time')
ylabel('Voltage')

subplot(4,2,3)
plot(tiq,po1i);
axis([0 1 -1 6]);
grid on;
title('I channel ADC output')
xlabel('   Time')
ylabel('Voltage')

subplot(4,2,5)
plot(tiq,po1q);
axis([0 1 -1 6]);
grid on;
title('Q channel ADC output')
xlabel('   Time')
ylabel('Voltage')

figure(5);%These values were obtained from program discussed in given reference with
%500000 symbols on each run.
err=[.2921 .2450 .1970 .1511 .1099 .0739 .0457 .0248 .0121 .0047 .0017 3.6e-4 7.8e-5];
snr=10.^ ( [0:0.1:12]./10);
Pbsym=erfc(.707*sqrt(snr)); % symbolBER (Theoretical-QPSK)
Pbbit=0.5*erfc(sqrt(snr)); % bitBER (Theoretical-BPSK)
semilogy([0:12],err,'*',[0:0.1:12],Pbsym,'-',[0:0.1:12],Pbbit,'--'); % plot
grid on; xlabel('SNR(dB)'); ylabel('BER');
title('Simulation of symbol and bit BER for QPSK and BPSK');
legend('QPSK Simulated','QPSKsymbol Theoretical','BPSKbit Theoretical');



%NOTES
%Serial to parallel conversion of a serial bit stream and mapping of
%two bits to a symbol(phase) can sometimes be confusing. I will try and explain
%with an example.
%Suppose you have a serial bit stream of ten  0 0 1 1 0 1 1 0 1 1 even # of bits      
                                %odd bits     0   1   0   1   1
                                %even bits      0   1   1   0   1
                                
%The odd bits are the I Channel Data at one half the original serial bit stream
%bit rate. Notice that the amplitudes are +/- one as shown in figure 1.
%The possible combinations(changing zero to -1) are -1 -1, 1 1, -1 1, 1 -1(four phases or four symbols).
%The amplitudes, in theory, should be held at +/- 0.707 to keep the summed output of the 
%QPSK transmitter at a  constant amplitude of +/- one.
%The even bits are the Q Channel Data at one half the original serial bit
%stream bit rate. The odd bits are the I Channel Data at one half the
%original serial bit streamm bit rate.

%Things to do:
%Implement BER code to prove that the BER of the output of either the I or
%Q channel is equal to the BER of BPSK. Also prove that the symbol
%BER(combined output) is ~ 3DB poorer than the I or Q channel output.
%Implement Gray coding and prove that the symbol BER approaches the BER of
%the I or Q channels at high S/N ratios.
%Implement different types of low pass filters for best BER. Appropriate TX and RX
%bandpass filters could also be added for best BER.

%==========================================================================
%Conclusions:
%==========================================================================
%I've come to the conclusion that accurate BER's can't be performed for
%QPSK at passband using this m-file.If someone figures out how to do it, let me know.
%Simulations must be setup using a baseband approach m-file construction. In other words,
%complex symbol inputs must be used. I've observed that even the Communication's Toolbox does
%not do a passband simulation for QPSK. This m-file, as configured, gives a good overview
%of how a real world QPSK systom would be configured. I've added several slicers
%(I call them one bit ADC'S) for drill and provided theoritical BER curves
%for bitBPSK and symbolQPSK systems. The following reference provides a baseband m-file 
%that uses a complex symbol input baseband approach and gives an accurate(theoretical
%matches simulated) symbol BER for QPSK. I have run the program with 500000
%symbols and put the results on figure 5 with *,s.
%Ref:www.cs.tut.fi/kurssit/ 83050/matlab_tehtavat/83050_M2.pdf 
%The math for probability of error for QPSK using distance(signal space) criteria from
%constellations shows the maximum distance between symbols for BPSK and
%QPSK to be the same and gives the same probability of error for each
%which means you can get something for nothing which is not true. QPSK is
%~3 dB poorer than BPSK because BPSK has only one possible bit for error where QPSK has 2
%bit per symbol that can be in error. If you use Gray coding QPSK can
%approach the BER of BPSK at higher SNR's. In a nutshell, always use a QPSK
%design with Gray coding(assuming you can handle the added design
%complexity) as you can send twice as many bits in the same amount of RF
%spectrum. QPSK is much more efficient than BPSK.




?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91在线精品秘密一区二区| 久久九九影视网| 亚洲黄色在线视频| 久久aⅴ国产欧美74aaa| 欧美日韩美少妇| 亚洲线精品一区二区三区| av一区二区久久| 91精品国产一区二区人妖| 午夜视频在线观看一区二区三区| 99久久久国产精品| 国产精品久久久久毛片软件| 国产高清不卡二三区| 欧美色国产精品| 视频在线观看一区| 欧美一区二区三区啪啪| 国产精品理伦片| 懂色一区二区三区免费观看| 国产欧美一区二区精品仙草咪| 国产一区二区剧情av在线| 久久综合色综合88| 精品一区二区三区在线观看国产| 91精品国产高清一区二区三区蜜臀| 婷婷成人激情在线网| 欧美在线高清视频| 日韩成人免费电影| 久久久精品综合| 精品一区二区三区欧美| 精品国一区二区三区| 国产不卡在线视频| 亚洲日本青草视频在线怡红院| 91亚洲大成网污www| 亚洲精品成人a在线观看| 欧美在线你懂的| 91偷拍与自偷拍精品| 亚洲午夜久久久久久久久电影院| 678五月天丁香亚洲综合网| 亚洲影视在线观看| 欧美一区二区精品| 成人视屏免费看| 亚洲激情图片小说视频| 欧美tickling挠脚心丨vk| 成人综合婷婷国产精品久久蜜臀 | 久久伊人蜜桃av一区二区| 大胆亚洲人体视频| 亚洲国产综合91精品麻豆| 久久天天做天天爱综合色| 99精品久久免费看蜜臀剧情介绍| 午夜精品久久一牛影视| 欧美激情在线免费观看| 欧美色精品在线视频| 美女性感视频久久| 国产精品对白交换视频| 日韩一区二区在线播放| 91香蕉视频mp4| 国产在线视视频有精品| 一区二区三区四区蜜桃| 久久久精品2019中文字幕之3| 色就色 综合激情| 高清视频一区二区| 日本欧美大码aⅴ在线播放| 欧美国产日韩精品免费观看| 日韩欧美不卡在线观看视频| 在线综合+亚洲+欧美中文字幕| 91久久久免费一区二区| 色综合久久久久久久| 99久久99久久久精品齐齐 | 国产一区二区三区四| 日本不卡的三区四区五区| 亚洲一区二区免费视频| 亚洲六月丁香色婷婷综合久久 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 精品伦理精品一区| 久久先锋影音av| 久久久精品黄色| 欧美国产禁国产网站cc| 欧美激情资源网| 中文字幕亚洲欧美在线不卡| 久久精品免费在线观看| 久久精品夜色噜噜亚洲aⅴ| 国产亚洲一二三区| 久久精品日产第一区二区三区高清版| 久久精品视频在线免费观看 | 中文av一区二区| 国产精品久久久久影院老司| 亚洲视频精选在线| 亚洲精品国产第一综合99久久| 一区二区三区不卡视频 | 7777精品久久久大香线蕉| 91精品国产色综合久久ai换脸| 在线成人小视频| 日韩亚洲欧美在线观看| 精品国产乱码久久久久久老虎| 精品久久久久久久久久久久久久久| 精品国产1区二区| 国产精品区一区二区三| 日韩美女精品在线| 亚洲成a人片在线不卡一二三区| 午夜国产精品一区| 精品午夜久久福利影院| 粉嫩av一区二区三区| 色综合咪咪久久| 欧美一区二区在线免费观看| www亚洲一区| 国产精品网站一区| 亚洲一区免费视频| 极品尤物av久久免费看| 成人黄色在线视频| 日本精品视频一区二区| 国产精品乱人伦中文| 欧美三区免费完整视频在线观看| 日韩成人一区二区三区在线观看| 欧美无砖砖区免费| 亚洲国产精品99久久久久久久久 | 欧美日韩一区 二区 三区 久久精品| 欧美视频中文字幕| 欧美v国产在线一区二区三区| 国产精品麻豆一区二区| 亚洲成年人网站在线观看| 国精品**一区二区三区在线蜜桃| 不卡电影免费在线播放一区| 欧美日韩亚洲综合| 欧美国产精品一区| 日韩不卡手机在线v区| 99久久精品久久久久久清纯| 欧美精品三级日韩久久| 国产精品天天看| 久久99国产精品久久| 在线影院国内精品| 久久九九久久九九| 日韩制服丝袜先锋影音| 91蜜桃网址入口| www国产成人| 五月天网站亚洲| 波多野结衣中文字幕一区| 日韩精品中文字幕在线不卡尤物 | 亚洲高清视频在线| 不卡的av在线| 久久综合五月天婷婷伊人| 五月天久久比比资源色| 色综合久久88色综合天天6 | 亚洲欧洲成人精品av97| 国产一区二区三区在线观看免费视频 | 欧美亚洲综合久久| 国产精品久久久久久妇女6080| 日本不卡在线视频| 欧美日韩五月天| 亚洲激情在线播放| 91首页免费视频| 中文字幕第一区二区| 韩国欧美国产1区| 日韩手机在线导航| 日本麻豆一区二区三区视频| 欧美性猛交xxxx乱大交退制版| 国产精品萝li| www.亚洲激情.com| 亚洲国产成人一区二区三区| 韩国av一区二区| 欧美成人激情免费网| 麻豆国产精品官网| 日韩视频免费直播| 美女视频网站久久| 日韩美女在线视频| 国产自产高清不卡| 久久综合久久久久88| 精品一区二区三区日韩| 26uuu国产一区二区三区| 精久久久久久久久久久| 久久免费视频色| 国产99久久久国产精品潘金| 久久久精品中文字幕麻豆发布| 国产精品影视天天线| 国产亚洲美州欧州综合国| 国产乱人伦精品一区二区在线观看 | 国产精品小仙女| 国产欧美一区二区精品仙草咪| 国产成人精品影视| 国产精品久久久久影院色老大| 97久久精品人人澡人人爽| 亚洲精品美国一| 欧美人牲a欧美精品| 日韩**一区毛片| 久久午夜电影网| 97精品久久久久中文字幕| 亚洲视频免费观看| 欧美高清性hdvideosex| 美国毛片一区二区| 久久久久久久网| 99精品久久99久久久久| 亚洲6080在线| 精品国产凹凸成av人导航| 丰满岳乱妇一区二区三区| 亚洲欧美经典视频| 日韩一区二区三| 国产盗摄精品一区二区三区在线| 最新欧美精品一区二区三区| 欧美在线免费观看亚洲| 久久99精品久久久久久国产越南| 日本一区二区视频在线观看| 日本高清免费不卡视频| 乱一区二区av|