Question about my matlab code

Status
Not open for further replies.

Kareem Hamed

Newbie level 4
Joined
Oct 22, 2014
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
125
please i want ask you why my code matlab don't work in the last 2 lines when i add cyclic prefix can you provide me how to correct my error in the last 2 lines?
thank you very much
Code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=64; 
N_phi=16;
Nd=48;
M=32;
K=2;
SP.ep1=0.5;
SP.ep2=-0.5;
L=8;
Lb=7;
g=7;
CP=20;
numSymbols=64;
NFFT=64;
SNR=1:30
%for n=1:length(SNR)
data=randi([0 15],1,Nd);
newdata=data.';
data2=qammod(newdata,16);
I=eye(64);
v_phi=1:4:64;
I(:,v_phi)=[];
xg1=I*data2;
data4=randi([0 15],1,Nd);
newdata2=data4.';
data5=qammod(newdata2,16);
I2=eye(64);
v_phi=2:4:64;
I2(:,v_phi)=[];
xg2=I2*data2;
%%%%%%%%%%%%%%%FFT,F HERMITION FL%%%%%%%%%%%%%%%%

F=fft(eye(N));
FL=F(:,1:L);
FH=F';

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%

%FL1=FL(1,:);
%FL2=FL(2,:);
%%%%%%%%%%%%%%%%%%%%%%%ADD CFO for user 1 and user 2%%%%%%%%%%%%%%%%%%%%%%%%%%
A1=diag(exp(j*pi*SP.ep1*1/N)*(0:N-1));
xg11=A1*F;
A2=diag(exp(j*pi*SP.ep2*1/N)*(0:N-1));
xg22=A2*F;
%%%%%%%%%%%%%%%%%%%add cyclic prefix for user 1%%%%%%%%%%%%%%%%%%
xg1_CP= [xg1(N-CP+1:N) xg1];
xg2_CP= [xg2(N-CP+1:N) xg2];
 

my code matlab don't work in the last 2 lines

Try being more clear; "don't work" means, wrong values other than expected, or runtime error ?
 

add semicolon as below
Code:
xg1_CP= [xg1(N-CP+1:N); xg1];
xg2_CP= [xg2(N-CP+1:N); xg2];
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…