请教下OFDM系统在matlab上的仿真程序!

 我来答
双眼皮小黑
2013-03-31
知道答主
回答量:35
采纳率:0%
帮助的人:11.2万
展开全部

%实现OFDM传输的仿真程序

para=128; %并行子信道的个数

fftlen:128; %FFT的长度

paradata=reshape(seldata,para,nd

*m1);

%QPSK调制

[ich,qch]=qpskmod(paradata,para,nd,m1);

kmod=1/sqrt(2);

ichl=ich.*kmod;

qchl=qch.*kmod;

%In叩(离散傅里叶反变换)

X=ichl+qchl.*i:

y=ifft(x);

ich2=real(y);

qch2=imag(y);

%插入保护间隔

[ich3,qch3]=giins(ich2,qch2,fftlen,gilen,nd);

fftlen2=fftlen+gilen;

%衰减计算

spow=suln(ich3.2+qch3.“2)/nd./para;

attn=0.5*spow*sr/br*10.“(.ebn0/10);

attn=sqrt(attn);

%高斯自信道

[ich4,qeh4]=eomb(ich3,qch3,attn);

%接收部分

%去除保护间隔

[ieh5,,qeh5]=girem(ich4,qch4,fftlen2,gilen,

nd);

%FFr(离散傅里叶变换)

IX=ich5+qch5.*i:

ry=fit(Ⅸ);

ich6=real(ry);

qch6=imag(ry);

%QPSK解调

ieh7=ich6./kmod;

qch7=qch6./kmod;

[derrtxtata]=qpskdemod(ich7,qch7,para,nd,m1);

%并串变换

demodatal=reshape(demodata,I,para*nd*rnl);

%比特误码率(BER)

bit—errors=find(seldata~=demodatal);

bit—error—count 2 size(bit—e/TOES,2);

total—bits=size(demodatal,2);

bit—error—rate=bit—error—count/total—bits;

fprintf(7%f\n’,bit—eITor—rate)

%end offile

程序运行结果,输出误码率为:

>>0.037109

 

ZESTRON
2024-09-04 广告
电子失效分析是指对电子元件或系统进行系统调查,以确定失效原因。通过显微镜、光谱学和电气测试等技术,分析人员可以查明导致故障的缺陷或问题。此过程包括检查物理损坏、分析电气特性和进行环境测试以确定根本原因。电子故障分析在半导体制造、汽车电子和消... 点击进入详情页
本回答由ZESTRON提供
匿名用户
2012-05-27
展开全部
clc;clear all;close all;echo off;tic;
% -------------------------------------------------------------------
% Parameter Definition
% --------------------------------------------------------------
Fd = 1; % symbol rate (1Hz)
Fs = 1*Fd; % number of sample per symbol
M = 4; % kind(range) of symbol (0,1,2,3)
Ndata = 1024; % all transmitted data symbol
Sdata = 64; % 64 data symbol per frame to ifft
Slen = 128; % 128 length symbol for IFFT
Nsym = Ndata/Sdata; % number of frames -> Nsym frame
GIlen = 144; % symbol with GI insertion GIlen = Slen + GI
GI = 16; % guard interval length
% ----------------------------------------------------------------
% Vector Initialization
% ----------------------------------------------------------------
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);
g = zeros(GIlen,1);
z2 = zeros(GIlen*Nsym,1);
z3 = zeros(GIlen*Nsym,1);
% random integer generation by M kinds
X = randint(Ndata, 1, M);
% digital symbol mapped as analog symbol
% Y1 is a Ndata-by-2 matrix, is changed into Y2 by "amodce"
Y1 = modmap(X, Fd, Fs, 'qask', M);
% covert to complex number
Y2 = amodce(Y1,1,'qam');
% figure(1);
% scatterplot(Y2,length(Y2),0,'bo');grid on;
scatterplot(Y2,Fd,0,'bo');grid on;
title('4-QAM Constellation');
Tx_spectrum = zeros(size(Y3));
for j=1:Nsym;
for i=1:Sdata;
Y3(i+Slen/2-Sdata/2,1)=Y2(i+(j-1)*Sdata,1);
Tx_spectrum = Tx_spectrum + abs(Y3);
end
z0=ifft(Y3);

for i=1:Slen; % generate time-domain vector, z1, without GI
z1(((j-1)*Slen)+i)=z0(i,1);
end
%
for i=1:Slen;
g(i+16)=z0(i,1);
end

for i=1:GI;
g(i)=z0(i+Slen-GI,1);
end
for i=1:GIlen; % generate time-domain vector, z2, with GI
z2(((j-1)*GIlen)+i)=g(i,1);
end

end
% graph on time domain
figure(2);
f = linspace(-Sdata,Sdata,length(z1));
plot(f,abs(z1));

Y4 = fft(z1); % FFT operation, at receiver
% if Y4 is under 0.01 Y4=0.001
for j=1:Ndata/Sdata*Slen;
if abs(Y4(j)) < 0.01
Y4(j)=0.01;
end
end
Y4 = 10*log10(abs(Y4)); % Y4 is used for spectrum display.
% graph on frequency domain
figure(3);
f = linspace(-Sdata,Sdata,length(Y4));
plot(f,Y4);grid on;
axis([-Slen/2 Slen/2 -20 20]);
title('Received OFDM signal spectrum');
figure(4);
f = linspace(-Sdata,Sdata,length(Y3));
plot(f,abs(Y3),'b-','LineWidth',6);grid on;
axis([-Slen/2 Slen/2 -2 2]);
title('Transmitted OFDM signal spectrum');
simulation_time = toc
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
dingjielidjl
2012-05-27
知道答主
回答量:7
采纳率:0%
帮助的人:6122
展开全部
% Vinay Mohan Jonnakuti
% Wireless Communication:
% BPSK modulation and demodulation with increased bit rate
%BPSK simulation using a carrier cosine wave with increased bit rate
clc;
close all;
clear all;

% no of sub carrier channels
channels=6;
c=6;
% bits per channels
bits=54
% total no of bits to be transmitted
n=324;
for i=1:n
data(i)= 2*round(rand)-1;
end

% Converting the series into parallel for the channels
s = reshape(data,c,bits);
% BPSK modulation for a single channel
signal1 = s(1,:);
%first expand the bit stream
exdata1=[];
exdata2=[];
exdata3=[];
exdata4=[];
exdata5=[];
exdata6=[];
for i=1:length(signal1)
for rep=1:2
exdata1= [exdata1 signal1(i)];
end
end

signal2 = s(2,:);
%first expand the bit stream
exdata=[];
for i=1:length(signal2)
for rep=1:2
exdata2= [exdata2 signal2(i)];
end
end

signal3= s(3,:);
%first expand the bit stream
exdata=[];
for i=1:length(signal3)
for rep=1:2
exdata3= [exdata3 signal3(i)];
end
end

signal4= s(4,:);
%first expand the bit stream
exdata=[];
for i=1:length(signal4)
for rep=1:2
exdata4= [exdata4 signal4(i)];
end
end

signal5= s(5,:);
%first expand the bit stream
exdata=[];
for i=1:length(signal5)
for rep=1:2
exdata5= [exdata5 signal5(i)];
end
end

signal6= s(6,:);
%first expand the bit stream
exdata=[];
for i=1:length(signal6)
for rep=1:2
exdata6= [exdata6 signal6(i)];
end
end

% Bpsk modulation
m=10*n;
% Generating the carrier signal
ts=.1;
tp=1:ts:11.79;
carrier1=cos(2*pi*tp);
% Generating the modulated signal 1
bpsk_sig1=exdata1.*carrier1;
% Generating the modulated signal 2
carrier2=cos(4*pi*tp);
bpsk_sig2=exdata2.*carrier2;
% Generating the modulated signal 3
carrier3=cos(6*pi*tp);
bpsk_sig3=exdata3.*carrier3;
% Generating the modulated signal 4
carrier4=cos(8*pi*tp);
bpsk_sig4=exdata4.*carrier4;
% Generating the modulated signal 5
carrier5=cos(10*pi*tp);
bpsk_sig5=exdata5.*carrier5;
carrier6=cos(12*pi*tp);
% Generating the modulated signal
bpsk_sig6=exdata6.*carrier6;
% taking the iFFT of each of these signals
if_sig1=ifft(bpsk_sig1);
if_sig2=ifft(bpsk_sig2);
if_sig3=ifft(bpsk_sig3);
if_sig4=ifft(bpsk_sig4);
if_sig5=ifft(bpsk_sig5);
if_sig6=ifft(bpsk_sig6);

fin(1,:)=if_sig1;
fin(2,:)=if_sig2;
fin(3,:)=if_sig3;
fin(4,:)=if_sig4;
fin(5,:)=if_sig5;
fin(6,:)=if_sig6;

transmit=reshape(fin,1,648);

% generating the noise
% p=rand(1,800)*2*pi;
p=rand*2*pi;
snr=10;
r=sqrt(-1*(1/snr*log(1 - rand)));
% no = 5*(r.* exp(j*p));
no = (r.* exp(j*p));
% value of alpha
al=rand+j*rand;
%al=1;
% Spreading channel with the alpha as the variable

for k=2:2:646
for l = 1:2
%al=round(rand)+j*round(rand)
rec(k+l)=transmit(k+l)+al*transmit(k-2+l);
end
end

rxdata=rec+ no ;

% Converting from serial to parallel
myrec=reshape(rxdata,6,108)

rxdata1=fft(myrec(1,:));
rxdata2=fft(myrec(2,:));
rxdata3=fft(myrec(3,:));
rxdata4=fft(myrec(4,:));
rxdata5=fft(myrec(5,:));
rxdata6=fft(myrec(6,:));

% taking the FFT

%begin demodulation
%first multiply recieved bitstream by cosine wave with carrier frequency

uncarry1=rxdata1.*carrier1;
uncarry2=rxdata2.*carrier2;
uncarry3=rxdata3.*carrier3;
uncarry4=rxdata4.*carrier4;
uncarry5=rxdata5.*carrier5;
uncarry6=rxdata6.*carrier6;

%plot(uncarry)
%demodulate by integrating
dec1=[];
dec2=[];
dec3=[];
dec4=[];
dec5=[];
dec6=[];
for inc=1:2:length(uncarry1)
dec=trapz(inc:inc+1,uncarry1(inc:inc+1));
dec1=[dec1 dec];
end
%2
for inc=1:2:length(uncarry2)
dec=trapz(inc:inc+1,uncarry2(inc:inc+1));
dec2=[dec2 dec];
end
%3
for inc=1:2:length(uncarry3)
dec=trapz(inc:inc+1,uncarry3(inc:inc+1));
dec3=[dec3 dec];
end
%4
for inc=1:2:length(uncarry4)
dec=trapz(inc:inc+1,uncarry4(inc:inc+1));
dec4=[dec4 dec];
end
%5
for inc=1:2:length(uncarry5)
dec=trapz(inc:inc+1,uncarry5(inc:inc+1));
dec5=[dec5 dec];
end
%6
for inc=1:2:length(uncarry6)
dec=trapz(inc:inc+1,uncarry6(inc:inc+1));
dec6=[dec6 dec];
end
final_rec(1,:)=dec1;
final_rec(2,:)=dec2;
final_rec(3,:)=dec3;
final_rec(4,:)=dec4;
final_rec(5,:)=dec5;
final_rec(6,:)=dec6;

fin_rec_parallel=reshape(final_rec,1,324)
%make decision with a threshold of zero
demod=[];
for i=1:length(fin_rec_parallel)
if fin_rec_parallel(i)>0
demod=[demod 1];
else
demod=[demod -1];
end
end

%stem(demod)

%calculate errors
error=0;
for i=1:length(demod)
if data(i)~=demod(i)
error=error+1;
end
end
error;

ber=error/324
figure(3)
stem(data)
hold
stem(demod,'rx')
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
18953730187
2012-05-26
知道答主
回答量:16
采纳率:0%
帮助的人:10.5万
展开全部
你是指哪方面呢?
追问
想找个OFDM 符号的频谱 散列图 和眼图
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式