Question

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?

Was it helpful?

Solution

Answer 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.

Answer 2: Add noise like this:

noisyValues = values .* noiseVector;

Create noiseVector with the characteristics of the noise you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top