Error in show Semilogy
Mostrar comentarios más antiguos
i have this graph that show BER after demodulation.

but in want to show BER after Equalizer too. So i can analysis BER from that graph. so i add this code " semilogy(EbNo,ber,'-or');".
but get error: Error in Vector must be the same length. what's wrong with my code? thank you in advance
this is my code :
%%MMSE
clear
disp('MMSE');
M = 8;
data = rand(1,501,1)'; %Generate random data symbols.
data(data<0.5)=0; data(data>=0.5)=1;
ber = 1; %Initializing
EbNo = 5;
i=1;
while ber(end) >= 1e-3
i=i+1;
EbNo(i) = EbNo(i-1) + 1;
ber(i-1) = berfading(EbNo(end),'psk',M,2);
end
y = awgn(data,EbNo(end)); y(y<mean(y))=0; y(y>=mean(y))=1;
PSK_mod = pskmod(y,M,pi/M);
PSK_demod = pskdemod(PSK_mod,M);
phasemod=PhaseMod(y);
phasedemod=PhaseDemod(phasemod);
eqlms = lineareq(8,lms(0.003)); %ekualizer
EQ = equalize(eqlms,PSK_demod,data); EQ(EQ>=0.5)=1; EQ(EQ<0.5)=0;
[m,n] = biterr(data,PSK_demod);
fprintf('BER after demodulation: %f.\n',n);
[m,n] = biterr(data,EQ);
fprintf('BER after equalizer: %f.\n',n);
fprintf('Thus BER decreases after Equalizer \n');
berMMSE = ber; EbNoMMSE = EbNo(1:length(ber));
figure();
semilogy(EbNoMMSE,berMMSE,'-or'); grid on; grid minor;
% axis([0 14 10^-5 0.5])
semilogy(EbNo,ber,'-or'); grid on; grid minor;
grid on
legend('sim-mmse');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('Bit error probability curve for 8PSK with MMSE equalizer');
Respuestas (1)
dpb
el 6 de Dic. de 2016
Well, the two vectors must not be the same length...to plot them against each other, they must be commensurate in size. Let's see what we can see...
...
i=i+1;
EbNo(i) = EbNo(i-1) + 1;
ber(i-1) = berfading(EbNo(end),'psk',M,2);
Aha! You save i values for EbNo, but ber is always one behind...where's the corresponding i value for it? Or, truncate the last EbNo entry or whatever is the correct way to line them up so there are same number of each...
2 comentarios
raizal muttaqin
el 7 de Dic. de 2016
dpb
el 7 de Dic. de 2016
Well, your x,y data aren't in synch...note your first Eb/No value is 1 whereas your reference plot begins at 0 and clearly the first value of BER is apparently an end effect or initialization artifact, not the actual computed value.
Your code isn't correct yet; just because it runs doesn't mean it doesn't have logic error. I don't know the field enough to be able to fix the logic without more time expended than I have to give; use the debugger and step through and likely you'll be able to spot what isn't as it should be...
Categorías
Más información sobre PHY Components en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

