views:

74

answers:

1

hi for the simulation of oqpsk i have written the below

    values = [0;1;0;0;1;0;1;0];
    h = modem.oqpskmod; 
    y = modulate(h, values); 
    g = modem.oqpskdemod(h); 
    z = logical(demodulate(g,y)); 
    BER = sum(values(:)-z(:))/numel(values);

my questions are as follows: 1) how can i verify that it does what i expect it to do (oqpsk mod/demod process)? 2) how can i introduce noise?

A: 

Hi

Ans 1: Write a statement like this:

assert(output == expectedOutput)

If this returns TRUE you have verified your code for one case. Repeat for a sufficient number and coverage of test cases to satisfy yourself. Seriously: write down a list of test cases and their inputs and expected outputs, check that your code produces the expected outputs.

Ans 2: Add noise like this:

noisyValues = values .* noiseVector;

Create noiseVector with the characteristics of the noise you want.

Regards

Mark

High Performance Mark
Two minor points: 1) The ASSERT function will do nothing if the condition is true, but will actually throw an error if it is false. 2) The resulting noisy input signal will have to be rounded off again to make it a vector of zeroes and ones.
gnovice