[問題] 有關通訊SER,有將問題化簡

作者: david94p (廷)   2018-06-10 01:07:38
https://i.imgur.com/HGaK4iT.jpg
clear all;
%%MATLAB CODE
ESOverN0_dB = -6:1:22; %% Es/N0 in dB
ESOverN0 = 10.^(ESOverN0_dB/10);
M = [2, 4, 8, 16];
figure(1);
clf;
for i = 1: length(M)
fun = @(x) 1./(sqrt(2.*pi)).*(1-0.5.*erfc(x./sqrt(2))).^(M(i)-1).*exp(-0.5
.*(x-sqrt(2.* ESOverN0 )).^2);
PC = trapz(fun,-10000,10000);
PE=0.5*(1-PC);
semilogy(ESOverN0_dB, PE, '-o', 'LineWidth', 2);
hold on;
end
xlabel('E_b/N_0 (dB)');
ylabel('Probability of Error');
axis([-6, 22, 1e-6,1e-1]);
grid;
在fun和積分那邊總是會有問題,有試過trapz,int,quad,quadl也沒辦法解決
另外他有顯示Matrix dimesions must agree,我不太清楚這是哪裡出錯
因為這是我第一次用matlab,可能有很多寫的不好的地方
※ 編輯: david94p (140.123.58.73), 06/10/2018 01:13:46
作者: LiamIssac (Madchester)   2018-06-10 07:35:00
把每一個乘項 個別印出來 看一下dimension是不是你要的

Links booklink

Contact Us: admin [ a t ] ucptt.com