0% found this document useful (0 votes)
10 views3 pages

Code For OFDM S - Organized-1 - Organized

The document describes an OFDM signal transmission and reception simulation in MATLAB. It generates random binary data, modulates the data using QAM onto OFDM subcarriers, transmits the signal over an AWGN channel, demodulates and recovers the data. Key steps include QAM modulation, IFFT/FFT, addition of noise, and BER calculation to evaluate performance.

Uploaded by

ranjith202324
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Code For OFDM S - Organized-1 - Organized

The document describes an OFDM signal transmission and reception simulation in MATLAB. It generates random binary data, modulates the data using QAM onto OFDM subcarriers, transmits the signal over an AWGN channel, demodulates and recovers the data. Key steps include QAM modulation, IFFT/FFT, addition of noise, and BER calculation to evaluate performance.

Uploaded by

ranjith202324
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

%c

odef
orOFDMs
ignal
trans
mis
sionandr
ecep
tion

i
nAWGNc
hannel

%c
ode

n=256;%Numb
erofb
itst
opr
oces
s

x=r
and
int
(n,
1);%Rand
omb
inar
ydat
ast
ream

M=16;%Si
zeofs
ignalc
ons
tel
l
ati
on

k=l
og2(
M);%Numb
erofb
itsp
ers
ymb
ol

xs
ym=b
i2d
e(r
eshap
e(x,
k,l
engt
h(x)
/k)
.'
,'
l
eft
-ms
b')
;

%Conv
ertt
heb
itsi
nxi
ntok-b
its
ymb
ols
.

y=mod
ulat
e(mod
em.
qammod
(M)
,xs
ym)
;

%Mod
ulat
eus
ingQAM

t
u=3.
2e-6;
%us
efuls
ymb
olp
eri
od

t
g=0.
8e-6;
%guar
dint
erv
all
engt
h

t
s=t
u+t
g;%t
otals
ymb
old
urat
ion

nmi
n=0;

nmax=64;
%tot
alnumb
erofs
ubc
arr
ier
s

s
cb=312.
5e3;
%subc
arr
iers
pac
ing

f
c=3.
6e9;
%car
rierf
requenc
y

Rs
=fc
;

t
t=0:6.
2500e-008:
ts-6.
2500e-008;

c
=if
ft(
y,nmax)
;%I
FFT

s
=real
(c'
.*(
exp
(1j
*2*p
i*f
c*t
t))
);%b
and
pas
s

mod
ulat
ion

f
igur
e;

p
lot
(real
(s)
,'
b'
);
tit
le(
'OFDMs
ignalt
rans
mit
ted
');

f
igur
e;
p
lot
(10*l
og10(
abs
(ff
t(s
,nmax)
)))
;ti
tl
e('
OFDM

s
pec
trum'
);

xl
abel
('
frequenc
y')

y
lab
el(
'powers
pec
trald
ens
ity
')

t
itl
e('
Trans
mits
pec
trumOFDM'
);

s
nr=10;
%si
gnalt
onoi
ser
ati
o

y
noi
sy=awgn(
s,s
nr,
'meas
ured
');
%awgnc
hannel

f
igur
e;

p
lot
(real
(ynoi
sy)
,'
b'
);
tit
le(
'rec
eiv
edOFDMs
ignal

wi
thnoi
se'
);

z=y
noi
sy.
*exp
(j*2*p
i*f
c*t
t);
%Band
pas
s

d
emod
ulat
ion

z=f
ft(
z,nmax)
;%FFT

zs
ym=d
emod
ulat
e(mod
em.
qamd
emod
(M)
,z)
;%d
emo

d
ulat
ionofb
and
pas
sdat
a.

z=d
e2b
i(zs
ym,
'l
eft
-ms
b')
;%Conv
erti
nteger
stob
its
.

z=r
eshap
e(z.
',
prod
(si
ze(
z))
,1)
;%mat
rixt
ovec
tor

c
onv
ers
ion

[
noe,
ber
]=b
iter
r(x,
z);
%BERc
alc
ulat
ionf
igur
e;

s
ubp
lot
(211)
;st
em(
x(1:
256)
);t
itl
e('
Ori
ginal

Mes
sage'
);

s
ubp
lot
(212)
;st
em(
z(1:
256)
);t
itl
e('
rec
over
ed

Mes
sage'
);

You might also like