UWBBPSK3.m
上传用户:asli888
上传日期:2013-05-03
资源大小:7045k
文件大小:15k
- %UWB-Run from editor debug(F5)-BPSK modulation and link analysis of
- %UWB fifth derivative Revised 1/24/05-JC
- %This m file plots the time and frequency waveforms for BPSK fifth derivative
- %equation of gaussian pulse used in UWB system analysis. The fifth
- %derivative waveform equation is obtained by use of the symbolic processor in
- %matlab.You would actually use the fourth derivative of the gaussian
- %monocycle which is t/pw*exp(-t^2/pw^2).Procedure as follows:
- %syms t pw
- %t/pw*exp(-t^2/pw^2)enter
- %diff(ans,t,4)
- %ans=60/pw^5*t*exp(-t^2/pw^2)-80/pw^7*t^3*exp(-t^2/pw^2)+16*t^5/pw^9*exp(-t^2/pw^2)
- %set pw=1 to normalize and do an ezplot(ans) and you should get a plot of the fifth order
- %derivative which has 5 zero crossings.It is apparent from previous files that the 1st and
- %second derivative pulses will not meet the FCC spectral mask without
- %reducing the transmitter power. The fifth order derivative meets the FCC
- %mask without a reduction in power. It also retains a wide 3DB and 10DB bandwidth.
- %One may ask how to generate these pulses at the transmitter. You could
- %take a baseband pulse and process it thru three differential highpass circuits(CR's) and
- %use a TX antenna that differentiates the pulse twice for fifth order. Assume
- %the RX antenna does not differentiate or integrate to preserve for fifth
- %order template(assuming a template is required).It may be possible
- %(for short distances and very high bit rates),to use DSSS(for smoothing and multiple access)with
- %a differential PSK(DPSK) scheme(squaring circuit with delay in one leg)
- %and FEC coding.This would solve a lot of design problems.
- %You would only lose several DB of Eb/No(1e-3) and would not require generation of a template at
- %the receiver for syncronization assuming timing jitter can be held to a minimum.There may
- %be other types of waveforms that will reduce the jitter and allow comparator and
- %clocked flip flop use instead of a high speed ADC.
- %Antenna and path distortion would be lessened using DPSK. The characteristics
- %of the fifth order waveform are as follows and which you can verify are:
- %pw(tail to tail)=~.5e-9
- %fc=~7Ghz
- %3DB fl to fh=~3GHz
- %10DB fl to fh=~6GHz
- %I would suggest you review other files published under UWB to get an
- %idea of the programs usage.
- %================================================
- clear
- Fs=100e9;%sample frequency
- Fn=Fs/2;%Nyquist frequency
- t=-.3e-9:1/Fs:45e-9;%time vector sampled at Fs Hertz. zoom in/out using (-1e-9:1/Fs:xxxx)
- %================================================
- % EQUATIONS
- %================================================
- %y=A*(t/pw).*exp(-(t/pw).^2);%1st derivative of Gaussian pulse=Gaussian monocycle
- %y =1*(1 - 4*pi.*((t)/pw).^2).* exp(-2*pi.*((t)/pw).^2);%2nd derivative of Gaussian
- %pulse=doublet(two zero crossings)
- pw=75e-12;%value sets pulse width of fifth derivative looking at figure 1
- y=((60./pw.^5).*(t-0).*exp(-(t-0).^2./pw.^2)-(80./pw.^7).*(t-0).^3.*exp(-(t-0).^2./pw.^2)+ ...
- (16.*(t-0).^5./pw.^9.*exp(-(t-0).^2/pw.^2)));%Fifth derivative of Gaussian pulse.(5 zero crossings)
- %================================================
- %NOISE SETUP FOR BER AND SNR
- %================================================
- noise=(1e-50)*(randn(size(t)));%(Noise-AWGN)Set to 1e-50 to disable
- %================================================
- %BPSK OR BI-PHASE MODULATION
- %================================================
- %The following series of equations sets the pulse recurring frequency(PRF)
- %at 200MHz(waveform repeats every 5e-9 sec and a
- %modulated bit stream(bit rate=200Mb/s)of 10101 (5 pulses,can add more)
- %where a {1=0 degrees(right side up) and a 1 bit} and a {-1=180
- %degrees(upside down) a 0 bit.}
-
- %==================================================
- % FIFTH DERIVATIVE(BPSK) WITH 5 PULSES)
- %==================================================
- %BPSK modulated fifth(yp)
- A=.6e-45;%sets voltage level out of TX or input to mixer(.6e-45 for .3mv volt peak)
- yp=A*y+ ...
- -A*((60./pw.^5).*(t-5e-9).*exp(-(t-5e-9).^2./pw.^2)-(80./pw.^7).*(t-5e-9).^3.*exp(-(t-5e-9).^2./pw.^2)+ ...
- (16.*(t-5e-9).^5./pw.^9.*exp(-(t-5e-9).^2/pw.^2)))+ ...
- A*((60./pw.^5).*(t-10e-9).*exp(-(t-10e-9).^2./pw.^2)-(80./pw.^7).*(t-10e-9).^3.*exp(-(t-10e-9).^2./pw.^2)+ ...
- (16.*(t-10e-9).^5./pw.^9.*exp(-(t-10e-9).^2/pw.^2)))+ ...
- -A*((60./pw.^5).*(t-15e-9).*exp(-(t-15e-9).^2./pw.^2)-(80./pw.^7).*(t-15e-9).^3.*exp(-(t-15e-9).^2./pw.^2)+ ...
- (16.*(t-15e-9).^5./pw.^9.*exp(-(t-15e-9).^2/pw.^2)))+ ...
- A*((60./pw.^5).*(t-20e-9).*exp(-(t-20e-9).^2./pw.^2)-(80./pw.^7).*(t-20e-9).^3.*exp(-(t-20e-9).^2./pw.^2)+ ...
- (16.*(t-20e-9).^5./pw.^9.*exp(-(t-20e-9).^2/pw.^2)));
- %-A inverts waveform
- %unmodulated fifth(yum)
- B=.6e-45;%sets voltage level
- yum=B*y+ ...
- B*((60./pw.^5).*(t-5e-9).*exp(-(t-5e-9).^2./pw.^2)-(80./pw.^7).*(t-5e-9).^3.*exp(-(t-5e-9).^2./pw.^2)+ ...
- (16.*(t-5e-9).^5./pw.^9.*exp(-(t-5e-9).^2/pw.^2)))+ ...
- B*((60./pw.^5).*(t-10e-9).*exp(-(t-10e-9).^2./pw.^2)-(80./pw.^7).*(t-10e-9).^3.*exp(-(t-10e-9).^2./pw.^2)+ ...
- (16.*(t-10e-9).^5./pw.^9.*exp(-(t-10e-9).^2/pw^2)))+ ...
- B*((60./pw.^5).*(t-15e-9).*exp(-(t-15e-9).^2./pw.^2)-(80./pw.^7).*(t-15e-9).^3.*exp(-(t-15e-9).^2./pw.^2)+ ...
- (16.*(t-15e-9).^5./pw.^9.*exp(-(t-15e-9).^2/pw.^2)))+ ...
- B*((60./pw.^5).*(t-20e-9).*exp(-(t-20e-9).^2./pw.^2)-(80./pw.^7).*(t-20e-9).^3.*exp(-(t-20e-9).^2./pw.^2)+ ...
- (16.*(t-20e-9).^5./pw.^9.*exp(-(t-20e-9).^2/pw.^2)));
- ym=yp+noise;%BPSK modulated fifth with noise
- %yum=yum+noise;%use this to put noise on unmodulated pulse train for DPSK
- %squaring circuit use.
- yc=ym.*yum;%yc(correlated output)=ym(modulated)times yum(unmodulated) fifth.
- %This is where the correlation occurs in the receiver and would be the
- %mixer in the receiver.
- %==================================================
- % FFT
- %==================================================
- %new FFT for BPSK modulated fifth(ym)
- NFFYM=2.^(ceil(log(length(ym))/log(2)));
- FFTYM=fft(ym,NFFYM);%pad with zeros
- NumUniquePts=ceil((NFFYM+1)/2);
- FFTYM=FFTYM(1:NumUniquePts);
- MYM=abs(FFTYM);
- MYM=MYM*2;
- MYM(1)=MYM(1)/2;
- MYM(length(MYM))=MYM(length(MYM))/2;
- MYM=MYM/length(ym);
- f=(0:NumUniquePts-1)*2*Fn/NFFYM;
- %new FFT for unmodulated fifth(yum)
- NFFYUM=2.^(ceil(log(length(yum))/log(2)));
- FFTYUM=fft(yum,NFFYUM);%pad with zeros
- NumUniquePts=ceil((NFFYUM+1)/2);
- FFTYUM=FFTYUM(1:NumUniquePts);
- MYUM=abs(FFTYUM);
- MYUM=MYUM*2;
- MYUM(1)=MYUM(1)/2;
- MYUM(length(MYUM))=MYUM(length(MYUM))/2;
- MYUM=MYUM/length(yum);
- f=(0:NumUniquePts-1)*2*Fn/NFFYUM;
- %new FFT for correlated pulses(yc)
- %yc is the time domain signal output of the multiplier
- %(modulated times unmodulated) in the correlation receiver. Plots
- %in the time domain show that a simple comparator and clocked flip flop instead of high speed A/D's
- %may be used to recover the 10101 signal depending on integrator design and level of
- %peak voltage into mixer.
- NFFYC=2.^(ceil(log(length(yc))/log(2)));
- FFTYC=fft(yc,NFFYC);%pad with zeros
- NumUniquePts=ceil((NFFYC+1)/2);
- FFTYC=FFTYC(1:NumUniquePts);
- MYC=abs(FFTYC);
- MYC=MYC*2;
- MYC(1)=MYC(1)/2;
- MYC(length(MYC))=MYC(length(MYC))/2;
- MYC=MYC/length(yc);
- f=(0:NumUniquePts-1)*2*Fn/NFFYC;
- %===================================================
- % PLOTS
- %===================================================
- %plots for modulated fifth(ym)
- figure(1)
- subplot(2,2,1); plot(t,ym);xlabel('TIME');ylabel('AMPLITUDE');
- title('Modulated pulse train');
- grid on;
- %axis([-1e-9,27e-9 -1 2])
- subplot(2,2,2); plot(f,MYM);xlabel('FREQUENCY');ylabel('AMPLITUDE');
- %axis([0 20e9 0 .0001]);%zoom in/out
- grid on;
- subplot(2,2,3); plot(f,10*log10(abs(MYM).^2));xlabel('FREQUENCY');ylabel('PSD');%PSD shown here
- %axis([0 12e9 -20 5]);
- grid on;
- %plots for unmodulated fifth(yum)
- figure(2)
- subplot(2,2,1); plot(t,yum);xlabel('TIME');ylabel('AMPLITUDE');
- title('Unmodulated pulse train');
- grid on;
- %axis([-1e-9,27e-9 -1 1])
- subplot(2,2,2); plot(f,MYUM);xlabel('FREQUENCY');ylabel('AMPLITUDE');
- %axis([0 10e9 0 .1]);%zoom in/out
- grid on;
- subplot(2,2,3); plot(f,20*log10(MYUM));xlabel('FREQUENCY');ylabel('20LOG10=DB');
- %axis([0 20e9 -120 0]);
- grid on;
- %plots for correlated pulses(yc)
- figure(3)
- subplot(2,2,1); plot(t,yc);xlabel('TIME');ylabel('AMPLITUDE');
- title('Receiver correlator output-no LPF');
- grid on;
- %axis([-1e-9,27e-9 -1 1])
- subplot(2,2,2); plot(f,MYC);xlabel('FREQUENCY');ylabel('AMPLITUDE');
- %axis([0 7e9 0 .025]);%zoom in/out
- grid on;
- subplot(2,2,3); plot(f,20*log10(MYC));xlabel('FREQUENCY');ylabel('20LOG10=DB');
- %axis([0 20e9 -120 0]);
- grid on;
- %===========================================================
- %CORRELATION RECEIVER COMPARATOR(before lowpass filter)
- %===========================================================
- pt=.1e-8%sets level where threshhold device comparator triggers
- H=5;%(volts)
- L=0;%(volts)
- LEN=length(yc);
- for ii=1:LEN;
- if yc(ii)>=pt;%correlated output(yc) going above pt threshold setting
- pv(ii)=H;%pulse voltage
- else;
- pv(ii)=L;
- end;
- end ;
- po=pv;%pulse out=pulse voltage
- %figure(3)
- subplot(2,2,4);
- plot(t,po);
- axis([-1e-9 27e-9 -1 6])
- title('Comparator output');
- xlabel('Frequency');
- ylabel('Voltage');
- grid on;
- %===================================================
- %SETUP and INFO
- %===================================================
- %Check axis settings on plots
- %Change t=-1e-9:1/Fs:(xxxx) to 1e-9 or proper value for viewing
- %Press F5 or run.
- %With waveform in plot 2,2,1(Figure 1), set pulse width to
- %.5e-9
- %Change t=-1e-9:1/Fs:(xxx) to something like 30e-9.Zoom out. I would
- %comment in all plot axis and use them for zooming in and out.
- %Press F5 and observe waveforms. Print or observe waveforms to compare with next set of
- %wave forms.
- %===================================================================
- % CORRELATION RECEIVER LOW PASS FILTER(INTEGRATOR)
- %=======================================================================
- rc=.5e-9;%time constant
- ht=(1/rc).*exp(-t/rc);%impulse response
- ycfo=filter(yc,1,ht)/Fs;%use this instead of ycfo=conv(yc,ht)/Fs for proper dimension.
- %The #=1 allows this. The LPF RC time constant(integrates over this time).
- %Theory states that it should be set to the pulse width but should be set
- %to a value that gives the best error free operation at the highest noise
- %levels. Different filter types(butterworth,etc) may give different
- %results.I don't have the butter function.
- %The 3DB or 1/2 power bandwidth on the RC LPF is f=1/(2*pi*RC). The noise
- %bandwith is f=1/(4*rc).
- yn=filter(noise,1,ht)/Fs;%looks at filtered noise only(Figure 5)
- %new FFT for filtered correlated pulses(ycfo)
- NFFYCFO=2.^(ceil(log(length(ycfo))/log(2)));
- FFTYCFO=fft(ycfo,NFFYCFO);%pad with zeros
- NumUniquePts=ceil((NFFYCFO+1)/2);
- FFTYCFO=FFTYCFO(1:NumUniquePts);
- MYCFO=abs(FFTYCFO);
- MYCFO=MYCFO*2;
- MYCFO(1)=MYCFO(1)/2;
- MYCFO(length(MYCFO))=MYCFO(length(MYCFO))/2;
- MYCFO=MYCFO/length(ycfo);
- f=(0:NumUniquePts-1)*2*Fn/NFFYCFO;
- %new FFT for filtered noise(yn)
- NFFYN=2.^(ceil(log(length(yn))/log(2)));
- FFTYN=fft(yn,NFFYN);%pad with zeros
- NumUniquePts=ceil((NFFYN+1)/2);
- FFTYN=FFTYN(1:NumUniquePts);
- MYN=abs(FFTYN);
- MYN=MYN*2;
- MYN(1)=MYN(1)/2;
- MYN(length(MYN))=MYN(length(MYN))/2;
- MYN=MYN/length(yn);
- f=(0:NumUniquePts-1)*2*Fn/NFFYN;
- %plots for filtered correlated pulses(ycfo)
- figure(4)
- subplot(2,2,1); plot(t,ycfo);xlabel('TIME');ylabel('AMPLITUDE');
- title('Receiver filtered correlator output');
- grid on;
- %axis([-1e-9,27e-9 -1 1])
- subplot(2,2,2); plot(f,MYCFO);xlabel('FREQUENCY');ylabel('AMPLITUDE');
- %axis([0 7e9 0 .25]);%zoom in/out
- grid on;
- subplot(2,2,3); plot(f,20*log10(MYCFO));xlabel('FREQUENCY');ylabel('20LOG10=DB');
- %axis([0 20e9 -120 0]);
- grid on;
- %=========================================================
- % CORRELATION RECEIVER COMPARATOR(after low pass filter)
- %=========================================================
- pt1=.1e-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 pt threshold setting
- pv1(ii)=H;%pulse voltage
- else;
- pv1(ii)=L;
- end;
- end ;
- po1=pv1;%pulse out=pulse voltage
- %figure(4)
- subplot(2,2,4);
- plot(t,po1);
- %axis([-1e-9 50e-9 -1 6])
- title('Comparator output');
- xlabel('Frequency');
- ylabel('Voltage');
- grid on;
- %plots for filtered noise(yn)
- figure(5)
- subplot(2,2,1);plot(t,yn);xlabel('TIME');ylabel('AMPLITUDE');
- title('Receiver filtered noise output');
- grid on;
- %axis([-1e-9,27e-9 -1 1])
- subplot(2,2,2); plot(f,MYN);xlabel('FREQUENCY');ylabel('AMPLITUDE');
- %axis([0 7e9 0 .25]);%zoom in/out
- grid on;
- subplot(2,2,3); plot(f,20*log10(MYN));xlabel('FREQUENCY');ylabel('20LOG10=DB');
- %axis([0 20e9 -120 0]);
- grid on;
- subplot(2,2,4);plot(t,ht);xlabel('TIME');ylabel('AMPLITUDE');
- title('impulse response(ht)');
- grid on;
- %axis([0,1e-9 0 1])
- %=========================================================
- %BER CALCULATIONS
- %=========================================================
- %I'm going to calibrate the noise generator and roughly determine the Eb/No or SNR in DB
- %that allows the system to operate almost error free(1e-3) in a noise environment.
- %This value of Eb/No is the number in DB that can be used in link
- %calculations. The calibration is required because in an actual TX-RX the received
- %voltage into the correlation receiver at the mixer will be in the low millivolt
- %region due to the FCC spectral mask at -41.3dBm/MHz and low transmitter power.
- %It will not be the 2 volt peak-peak BPSK used here and must be recalibrated if
- %different than 2 volt peak-peak.
-
- %The Eb/No value in DB is calculated as follows. Doing numerous runs by hand and
- %observing the LPF comparator output in figure 4, determine the proper
- %setting of the comparator threshold setting, RC filter time constant and
- %level of multiplier(0.1 to 1) in AWGN noise generator that gives almost error
- %free operation. This will be considered Eb/No in DB.For BPSK theory this value is 7DB for BER of 1e-3.
- %For a SNR of 7 DB, 20*LOG10(ratio of Vsigp-p/Vnoisep-p=7DB.
- %You can do your own calibration method if you don't think
- %this is correct. Remember to recalibrate for new pulse widths and amplitude changes
- %into the mixer and pay attention to axis settings. There are a few to keep track of.
-
- %I did some preliminary link caculations with this set up and determined that approx 0.6mv p-p
- %would be present on the mixer input for the following conditions.(0.3mvpeak
- %for 0 and 180 degrees)
- %========================================================
- %FCC spectral mask -41.3dBm/MHz+10LOG10(~4000)=~-5dBm(aver TX power Pt)
- %antenna gains 0DBi(50 ohms)
- %lna 20DB gain
- %NF 10 DB
- %distance 1 meter
- %(PL)path loss~45DB
- %200Mbit rate(Rb)
- %BW~318Mhz 3DB BW(LPF)(RC=.5e-9)
- %Pn(receiver noise level)=KTB=-114dBm+NF+10log10(Rb)=-114dBm+10DB+23DB=-81dBm
- %3DB to 10DB spread of pulse ~3 to 6GHz(use 4GHz)
- %pw=.5e-9 fifth derevative
- %fc=~7Ghz
- %Eb/No=7DB(1e-3)
- %power received(Pr)@ant=-5dBm-45DB(PL)=-50dBm over ~4GHz.
- %Link margin=Pr-Pn-Eb/No
- %Link margin@ 1 meter=-50dBm-(-81dBm)-(7DB)=24DB
- %Emixerp-p=sqrt(1e-5mw*50)=2.23e-2mvrms*1.41=0.03mvpeak*20DB(lna)gain=0.3mvpeak or 0.6mvp-p