Help using randn and pskmod

I have taken random data using randn and then psk modulated it...But i get error.
M=1024;
m=4;
msg1=randn(M,1,m);
msg2=randn(M,1,m);
msg=vertcat(msg1,msg2);
% QPSK modulation
qpsk_modulated_data1=pskmod(msg1,m);
qpsk_modulated_data2=pskmod(msg2,m);

댓글 수: 2

Daniel Shub
Daniel Shub 2012년 3월 26일
What error?
Janet
Janet 2012년 3월 26일
Error using ==> pskmod
Elements of input X must be integers in [0, M-1].

댓글을 달려면 로그인하십시오.

 채택된 답변

Wayne King
Wayne King 2012년 3월 26일

0 개 추천

You want to generate your data using randi() like this:
M = 4;
msg1 = randi([0, 3],1024,1);
qpsk_modulated_data1 = pskmod(msg1,M);

댓글 수: 8

Janet
Janet 2012년 3월 26일
i get errors
Wayne King
Wayne King 2012년 3월 26일
Janet, I have shown you how to use randi(), which is what you want. Please show what errors you get with the above.
Janet
Janet 2012년 3월 26일
Undefined command/function 'randi'.
Thomas
Thomas 2012년 3월 26일
hmm.. randi is a built-in function..
can you do a
>>which randi
and give the output
Janet
Janet 2012년 3월 26일
am using matlab 7.0...there is no randi function
Wayne King
Wayne King 2012년 3월 26일
How about randint()
msg1 = randint(1024,1,[0,3]);
Daniel Shub
Daniel Shub 2012년 3월 26일
How about round(M*rand(1,m))
Janet
Janet 2012년 3월 26일
@wayne : i get using randint

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Daniel Shub
Daniel Shub 2012년 3월 26일

0 개 추천

You realize that
randn(M,1,m)
is not going to produce integers in the range [0, m-1]? Maybe you want
doc randi

카테고리

태그

질문:

2012년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by