Error using reshape, To RESHAPE the number of elements must not change?

3 ビュー (過去 30 日間)
long zhang
long zhang 2018 年 11 月 23 日
コメント済み: Jan 2018 年 11 月 24 日
function mod_out=modulation(mod_in,mod_mode)
%function discription:
%Input::The sequence to be modulated
%Output: mod_out,The output after modulation
switch (mod_mod)
case 2
for i=1:length(mod_in)% The sequence to be modulated
if mod_in(i)==0
mod_out(i)=-1;
else
mod_out(i)=1;%the contellation mapping
end
end
disp(mod_out);
cose 4
mod_out=zeros(1,length(mod_in)/2);
R=reshape(mod_in,2,length(mod_in)/2); %Convert the input sequence to a matrix of (2,length(x)/2)
B2D=bi2de(R','left-msb')+1;%Convert binary to decimal
Temp=[-1-1j -1+1j 1-1j 1+1j];
for i=1:length(mod_in)/2
mod_out(i)=Temp(B2D(i))/sqrt(2);%Nomalized
end
end
the error"R=reshape(........)
I need help!
  2 件のコメント
madhan ravi
madhan ravi 2018 年 11 月 23 日
when you ask a question , provide all the datas(values) to run your code
long zhang
long zhang 2018 年 11 月 24 日
thanks, got it!

サインインしてコメントする。

採用された回答

Matt J
Matt J 2018 年 11 月 23 日
Try this,
R=reshape(mod_in,2,[]);
  5 件のコメント
long zhang
long zhang 2018 年 11 月 24 日
I see! thanks a lot!:)
Jan
Jan 2018 年 11 月 24 日
@long zhang: Please use flags only to informa admins and editors about message, which might collide with the terms of use, e.g. spam or rudeness. Thanks.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCommunications Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by