-1
我試圖在N = 2時使用zeroforcing編寫quadrature phase-shift keying(QPSK)的代碼,並且出現錯誤。如何解決MATLAB中未定義的函數錯誤?
下面是代碼:
Modulation = 'QPSK'
Decode_Method = 'ZeroForcing'
switch Modulation
case {'QPSK'}
Symbols = [ 1+j 1-j -1+j -1-j ]';
end
Symbols = Symbols.';
nSymbols = length(Symbols);
SNR_Array = [0.3 0.7 1.2 2.5 5 6.2 10 15.4 22 45 75.7 100.0];
nSNR = length(SNR_Array);
Ntest = 20;
N = 2;
for iSNR = 1 : nSNR
SNR = SNR_Array(iSNR);
Nerror = 0;
for i = 1:Ntest
H = randn(N,N) + j*randn(N,N);
X = Symbols(ceil(nSymbols*rand(N,1)))';
Noise = (randn(N,1) + j*randn(N,1))/sqrt(2)/sqrt(SNR);
Y = H*X + Noise;
switch Decode_Method
case {'ZeroForcing'}
X_Decode = Zero_Forcing(Y,H,Symbols);
end
end
Nerror = Nerror + length(find(X ~= X_Decode));
end
Symbol_Error_Rate(iSNR) = Nerror/Ntest/N;
figure(1)
loglog(SNR_Array, Symbol_Error_Rate,'b')
hold on
xlabel('SNR')
ylabel('Symbol Error Ratio')
title('Symbol Error Ratio for NxN MIMO System')
和錯誤是:
???對'double'類型的輸入參數未定義的函數或方法'Zero_Forcing'。
錯誤==>無標題2在33
X_Decode = Zero_Forcing(Y,H,Symbols);
我該如何解決這個錯誤?