[SOLVED] How to fix error: To RESHAPE the number of elements must not change?

Status
Not open for further replies.

matthew989

Newbie level 4
Joined
Mar 3, 2018
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
63
Hi all,
I'm trying to write Matlab code for OFDM receiver block for 16QAM. but I have an error with reshape command.

Code:
Bit_Num = 4; 
FFT_Num = 64; 
Carrier_Num = 48;
OFDM_per_Symbol = 1; 
CP = 16;  
LI = 12; 
Np = 4; % Number of pilot
Carriers = 1:Carrier_Num + Np;
N_Num = Bit_Num * Carrier_Num * OFDM_per_Symbol;

%Generate the random binary stream for transmit test 

BitTx = randi(1,N_Num);

%Modulate (generates 16QAM symbols)

N_Num = length(BitTx);
SymQAMtmp = reshape(BitTx,4,N_Num/4).'; 
SymQAMtmptmp=bi2de(SymQAMtmp,2,'left-msb');
...;
 

It is hard to say when you give so little description of what you are trying to achieve. I presume what you are doing is based on the 802.11g WiFi standard.

Firstly, I suspect you have not looked at how the randi() function should be called. I suspect you may want something more like:


Code Matlab M - [expand]
1
BitTx = randi([0,1],N_Num,1);



There are probably other issues with your code. For example, it seems likely to me that you should be using Bit_Num in some of the places that you have hard-coded the number 4. I suggest you spend a minute to describe what your intentions are.
 
thank you so much. for randi I should write [0,1] to generate the random binary number.
 

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