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');

답변 (1개)

dpb
dpb 2016년 12월 6일

0 개 추천

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

thank you sir. i have change my code with:
...
i=i+1;
EbNo(i) = EbNo(i-1) + 1;
ber(i-1) = berfading(EbNo(end),'psk',M,2);
my output is given
MMSE
BER after demodulation: 0.755489.
BER after equalizer: 0.157685.
But in my output graph still got error. i add this code:
semilogy(EbNo,ber,'-or');
so i can show graph after and before equalizer. the code is not error. but the output still doesn't give expectation output. this is my output in graph
my expectation output is like this graph :
:
dpb
dpb 2016년 12월 7일
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...

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 PHY Components에 대해 자세히 알아보기

질문:

2016년 12월 6일

댓글:

dpb
2016년 12월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by