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 Comments

What error?
Error using ==> pskmod
Elements of input X must be integers in [0, M-1].

Sign in to comment.

 Accepted Answer

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 Comments

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

Sign in to comment.

More Answers (1)

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

Tags

Asked:

on 26 Mar 2012

Community Treasure Hunt

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

Start Hunting!