ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Modulacion QAM


Enviado por   •  19 de Diciembre de 2012  •  651 Palabras (3 Páginas)  •  342 Visitas

Página 1 de 3

%Run from editor Debug(F)

%This m file(ASK.m) analyzes a coherent amplitute shift keyed(ASK) and a binary

%phase shift keyed(BPSK) communication system. The receiver uses a correlator

%(mixer-integrator [lpf]) configuration with BER measurements comparing measured

%and theoretical results. The band pass and low pass filters used in the receiver are

%constructed using z transforms. M files on BPF and LPF design using z

%transforms can be found in the author index (CJ) mathworks file exchange. A fundemental

%question to ask is: "Why does BPSK show a 3dB improvement(as you will see using the

%program)in BER over ASK?". A simple answer is that the signal for ASK is being

%transmitted only half the time. A reference is provided at the end of the program that

%was used in writing the program. Always remember a journey of a thousand

%miles requires a first one small step.

%========================================

% Set universal parameters

% =======================================

clear

fs=8e5;%sampling frequency

fm=20e3;%square wave modulating frequency(NRZ)= 40KHz bit rate

n=2*(6*fs/fm);

final=(1/fs)*(n-1);

fc=2e5; % carrier frequency

t=0:1/fs:(final);

Fn=fs/2;%nyquist frequency

%=========================================

%Generate square wave by using cosine wave

%==========================================

% cosine wave

% 2 pi fc t is written as below

twopi_fc_t=2*pi*fm*t;

A=1;

phi=0;

x = A * cos(twopi_fc_t + phi);

% square wave

am=1;

x(x>0)=am;

%x(x<0)=0;%use for ASK-comment out BPSK

x(x<0)=-1;%use for BPSK-remember ASK variables become BPSK

subplot(321);

plot(t,x);

axis([1e-4 3e-4 -2 2]);

title('Square Wave Modulating Input To Transmitter');

grid on

car=sin(2*pi*fc*t);%Sinewave carrier waveform

ask=x.*car;%modulate carrier(ASK or BPSK)

subplot(322);

plot(t,ask);

axis([0 100e-6 -2 2]);

title('Modulated Sinewave Carrier Waveform');

grid on;

%=====================================================

%Noise generator SNR=Eb/No=20log(Signalrms/Noiserms)

%======================================================

%vn=0;

vn=.1;%set noise level 0.1~=6db=SNR=Eb/No

noise=vn*(randn(size(t)));%noise generator

subplot(323);

plot(t,noise);

grid on;

title('Noise Level');

axis([0 .6e-3 -1 1]);

askn=(ask+noise);%modulated carrier plus noise

subplot(324);

plot(t,askn);

axis([0 100e-6 -2 2]);

title('Modulated Carrier Waveform Plus Noise');

grid on;

%======================================================================

%Receiver bandpass filter(two poles two zeros)

%======================================================================

fBW=40e3;

f=[0:3e3:4e5];

w=2*pi*f/fs;

z=exp(w*j);

BW=2*pi*fBW/fs;

a=.8547;%BW=2(1-a)/sqrt(a)

p=(j^2*a^2);

gain=.135;

Hz=gain*(z+1).*(z-1)./(z.^2-(p));

subplot(325);

plot(f,abs(Hz));

title('Receiver Bandpass Filter Response');

grid on;

Hz(Hz==0)=10^(8);%avoid log(0)

subplot(326);

plot(f,20*log10(abs(Hz)));

grid on;

title('Receiver -3dB Filter Response');

axis([1e5 3e5 -3 1]);

%filter coefficients

a=[1 0 .7305];%[1 0 p]

b=[.135 0 -.135];%gain*[1 0 -1]

faskn=filter(b,a,askn);

figure;

subplot(321);

plot(t,faskn);

axis([0 100e-6 -2 2]);

title('Receiver BPF Output');

grid on;

cm=faskn.*car;%multiply modulated carrier with unmodulated carrier

subplot(322);

plot(t,cm);

axis([0 100e-6 -2 2]);

grid on;

title('Receiver Multiplier Output');

%===================================================================

%Low pass filter(one pole one zero)

%==================================================================

p=.72;

gain1=.14;%gain=(1-p)/2

Hz1=gain1*(z+1)./(z-(p));

%0.65=53KHz

%0.7=45KHz

%0.72=40KHZ=best for lowest BER-Theory says set equal to the bit rate

%0.75=37KHz

%0.8=28KHz

%subplot(323);

%plot(f,abs(Hz1));

%title('Receiver LPF Response');

%grid on;

subplot(323);

Hz1(Hz1==0)=10^(-8);%avoid log(0)

plot(f,20*log10(abs(Hz1)));

grid on;

title('LPF -3dB response');

...

Descargar como (para miembros actualizados) txt (8 Kb)
Leer 2 páginas más »
Disponible sólo en Clubensayos.com