Calculating bit-error-rate of QPSK data I am working on a simulation of QPSK data using the code below (Matlab):

j = sqrt(-1);
N = 10^6; % number of symbols
Es_N0_dB = 12; % ratio of signal energy to noise energy in dB
QP = (2*(rand(1,N)&gt;0.5)-1)+j*(2*(rand(1,N)&gt;0.5)-1); % actual QPSK data
s = (1/sqrt(2))*QP; % normalization of energy to 1
n = 1/sqrt(2)*(randn(1,N)+j*randn(1,N)); % white Gaussian noise, 0 dB variance
y = s + 10^(-Es_N0_dB/20)*n; % recovered noisy data
plot(y, 'b.')


This is my resulting constellation diagram:



To identify the errors (and calculating the bit-error-rate), I have divided the diagram into 4 quadrants and used the following to find out which elements have changed sign (i.e. crossed the decision boundaries):

sr=real(s); si=imag(s);
yr=real(y); yi=imag(y);

for i = 1:N
    if sr(i)*yr(i)&lt;0
        errorI(i)=yr(i);
        if si(i)*yi(i)&lt;0
            errorQ(i)=yi(i);
        end
    end
end

err = errorI+j*errorQ;
BER = numel(err)/numel(y);


However, this does not return any data for the in-phase and quadrature errors. What is the problem with this approach?

Any explanation would be greatly appreciated.
You're not doing anything conceptually wrong, you're just misunderstanding MATLAB. The code as you provided it doesn't execute properly; here's a fixed script:

% don't need this; MATLAB already knows what j is
%j = sqrt(-1);
N = 10^6; % number of symbols
Es_N0_dB = 12; % ratio of signal energy to noise energy in dB
QP = (2*(rand(1,N)&gt;0.5)-1)+j*(2*(rand(1,N)&gt;0.5)-1); % actual QPSK data
s = (1/sqrt(2))*QP; % normalization of energy to 1
n = 1/sqrt(2)*(randn(1,N)+j*randn(1,N)); % white Gaussian noise, 0 dB variance
y = s + 10^(-Es_N0_dB/20)*n; % recovered noisy data
plot(y, 'b.')
sr=real(s); si=imag(s);
yr=real(y); yi=imag(y);

% it seems like you want to predeclare these since you're indexing them below
errorI = zeros(size(s));
errorQ = zeros(size(s));

for i = 1:N
    if sr(i)*yr(i)&lt;0
        errorI(i)=yr(i);
        if si(i)*yi(i)&lt;0
            errorQ(i)=yi(i);
        end
    end
end

err = errorI+j*errorQ;
% BER is the number of nonzero entries in `err` divided by the number of chances
BER = sum(err ~= 0) / length(y);