Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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];
 

andre_luis

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,479
Helped
1,183
Reputation
2,385
Reaction score
1,181
Trophy points
1,403
Location
Brazil
Activity points
54,957
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 ?
 

kaz1

Full Member level 4
Joined
Aug 15, 2019
Messages
191
Helped
14
Reputation
28
Reaction score
31
Trophy points
28
Location
UK
Activity points
1,277
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top