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 Kommentare

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

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Wayne King
Wayne King am 26 Mär. 2012

0 Stimmen

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 Kommentare

Janet
Janet am 26 Mär. 2012
i get errors
Wayne King
Wayne King am 26 Mär. 2012
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 am 26 Mär. 2012
Undefined command/function 'randi'.
Thomas
Thomas am 26 Mär. 2012
hmm.. randi is a built-in function..
can you do a
>>which randi
and give the output
Janet
Janet am 26 Mär. 2012
am using matlab 7.0...there is no randi function
Wayne King
Wayne King am 26 Mär. 2012
How about randint()
msg1 = randint(1024,1,[0,3]);
Daniel Shub
Daniel Shub am 26 Mär. 2012
How about round(M*rand(1,m))
Janet
Janet am 26 Mär. 2012
@wayne : i get using randint

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Daniel Shub
Daniel Shub am 26 Mär. 2012

0 Stimmen

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

Community Treasure Hunt

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

Start Hunting!

Translated by