On Aug 2, 7:57�am, zingas <shammashah...@gmail.com> wrote:
> hi
> i am using this code for simulation of ofdm
>
[snip]
>
> Now i want to output BER vs SNR curve what should i do
> tHaNx
Homework?
Reply by zingas●August 2, 20082008-08-02
hi
i am using this code for simulation of ofdm
clear all;
Fd=1; % symbol rate (1Hz)
Fs=1*Fd; % number of sample per symbol
M=4; % kind(range) of symbol (0,1,2,3)
Ndata=128; % all transmitted data symbol
Sdata=8; % 8 data symbol per frame to ifft
Slen=16; % 16 length symbol for IFFT
X=zeros(Ndata,1);
Y1=zeros(Ndata,1);
Y2=zeros(Ndata,1);
Y3=zeros(Slen,1);
z0=zeros(Slen,1);
z1=zeros(Ndata/Sdata*Slen,1);
% random integer generation by M kinds
X = randint(Ndata, 1, M);
% digital symbol mapped as analog symbol
Y1 = modmap(X, Fd, Fs, 'qask', M);
% covert to complex number
Y2=amodce(Y1,1,'qam')
j=1
for i=1:Sdata;
Y3(i+Slen/2-Sdata/2,1)=Y2(i+(j-1)*Sdata,1);
end
z0=ifft(Y3)
for i=1:Slen;
z1(((j-1)*Slen)+i)=z0(i,1);
end
Y4 = fft(z1,Ndata*Ndata);
for j=1:Ndata/Sdata*Slen;
if abs(Y4(j)) < 0.0001
Y4(j)=0.0001;
end
end
Y4 = 10*log10(abs(Y4));
figure(1);
f = linspace(-Sdata,Sdata,length(Y4));
plot(f,Y4,'k');
hold on;
Now i want to output BER vs SNR curve what should i do
tHaNx