+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 1
    Points: 935, Level: 6

    Join Date
    Oct 2014
    Posts
    4
    Helped
    0 / 0
    Points
    935
    Level
    6

    Question about my matlab code

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

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 29,576, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,837
    Helped
    1114 / 1114
    Points
    29,576
    Level
    41
    Blog Entries
    9

    Re: Question about my matlab code

    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 ?
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisement

        
       

  3. #3
    Newbie level 2
    Points: 16, Level: 1

    Join Date
    Aug 2019
    Posts
    2
    Helped
    0 / 0
    Points
    16
    Level
    1

    Re: Question about my matlab code

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



--[[ ]]--