Im having trouble fixing the "cannot be classified error" in my parfor loop (The variable perror in a parfor cannot be classified)

1 visualización (últimos 30 días)
close all;clear LSNR=0;USNR=1;limit=4; load code_k_mod G1=G; H1=H; rate=4; % Code rate R=1/rate ind=1; indx =1; fid=fopen('Parallel_k_n_L_test_16_6_2014.txt','wt'); parfor SNR=LSNR:0.5:USNR undetected_errors = 0; SNR % Intitializing counters frmerror=0; bitnerr=0; frames=0; while frmerror < limit frames=frames+1 if mod(frames,1000)==0 frames; frmerror; end b=rand_bit(size(G1,1),0.5); co=turbo_encoder_no_int(b,G1); cod1=co; cod=2*cod1-1; EbN0=10^((SNR)/10); si= 1/sqrt(2*(1/rate)*EbN0); noise = (si*randn(size(cod))); tran= cod+noise;
rcv=(tran);
% decoder
[success,kr,dd0,x_hat1]=turbo_decoder_infectious_no_int_z_9_6_2010(rcv,si,H1,co,fid,frames);
% ---------------------------------------------
dseq1=dd0;
% B E R ------------------
error=sum(abs(dseq1-b));
perror1=error/size(b,2);
perror(frames)=perror1;
if error~=0
frmerror=frmerror+1
bitnerr=bitnerr+error;
if success == 1
undetected_errors = undetected_errors +1;
c_w(indx,:) = co;
noise_w(indx,:) = noise;
b_w(indx,:) = b;
kr_w(indx,:) = kr;
x_hat1_w(indx,:) = x_hat1;
indx = indx +1;
save debug c_w noise_w b_w kr_w x_hat1_w x_hat2_w x_hat3_w
end
end
end
merror=mean(perror);
ferror(ind)=merror;
frmerr(ind)=frmerror;
ind=ind+1;
bits=frames*size(G1,1);
BER=bitnerr/bits
FER=frmerror/frames
end
fclose('all');

Respuesta aceptada

Raymond Norris
Raymond Norris el 19 de Ag. de 2014
The formatting of the code isn't displaying properly, so I may not have the same code you have. Could you reformat it? Assuming I have it right, there are a couple of issues, though not classifying perror wasn't one of them. Which version of MATLAB are you running?
  1. The parfor must increase by 1 (not 0.5)
  2. Look up transparency rules -- you can't call save within the parfor
  1 comentario
Ahmed
Ahmed el 21 de Ag. de 2014
Thanks for reply Actually,I did both your advice but the same error result as in code below (The variable perror in a parfor cannot be classified)
SNRdB=0:0.5:5; SR=length(SNRdB);
parfor SNR=1:SR undetected_errors = 0; SNR
% Intitializing counters
frmerror=0;
bitnerr=0;
frames=0;
while frmerror < limit
frames=frames+1
if mod(frames,1000)==0
frames
frmerror
end
b=rand_bit(size(G1,1),0.5);
co=turbo_encoder_no_int(b,G1);
cod1=co;
cod=2*cod1-1;
% Channel ----------------
% ------------------------
EbN0=10^((SNR)/10);
si= 1/sqrt(2*(1/rate)*EbN0);
noise = (si*randn(size(cod)));
tran= cod+noise;
% ------------------------
------------------------
rcv=(tran);
% Decoder ---------------
[success,kr,dd0,x_hat1]=turbo_decoder_infectious_no_int_z_9_6_2010(rcv,si,H1,co,fid,frames);
% ---------------------------------------------
dseq1=dd0;
% B E R ------------------
% ------------------------
error=sum(abs(dseq1-b));
perror1=error/size(b,2);
perror(frames)=perror1;
if error~=0
frmerror=frmerror+1
bitnerr=bitnerr+error;
if success == 1
undetected_errors = undetected_errors +1;
c_w(indx,:) = co;
noise_w(indx,:) = noise;
b_w(indx,:) = b;
kr_w(indx,:) = kr;
x_hat1_w(indx,:) = x_hat1;
indx = indx +1;
%save debug c_w noise_w b_w kr_w x_hat1_w x_hat2_w x_hat3_w
end
end
end
merror=mean(perror);
ferror(ind)=merror;
frmerr(ind)=frmerror;
ind=ind+1;
bits=frames*size(G1,1);
BER=bitnerr/bits
FER=frmerror/frames
end
fclose('all');
toc;

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by