Filter löschen
Filter löschen

neural network isn't training properly. It shows "minimum gradient reached" just after few epochs.

1 Ansicht (letzte 30 Tage)
I am trying to write a code for "channel estimation in OFDM using neural networks" but the results of neural network aren't satisfactory. Though I manually changed the gradient to greater value, but stil no improvement. Could anyone please tell me the reason behind it. It is very urgent.
The code is given below:
clc clear all
nCP = 16; %round(Tcp/Ts); nFFT = 64; NT = nFFT + nCP; F = dftmtx(nFFT)/sqrt(nFFT); MC = 2; kk=32; EsNodB = 0:5:31; snr = 10.^(EsNodB/10); beta = 17/9; M = 16; modObj = modem.qammod(M); demodObj = modem.qamdemod(M); L = 5; %ChEstLS = zeros(1,length(EsNodB)); %ChEstMMSE = zeros(1,length(EsNodB)); tic; E=[] % Random channel taps g = randn(L,1)+1i*randn(L,1); g = g/norm(g); H = fft(g,nFFT);
for ii = 1:length(EsNodB) disp('EsN0dB is :'); disp(EsNodB(ii)); ChMSE_LS = 0; ChMSE_LMMSE=0; error=0; error1=zeros(1,32); %for mc = 1:MC
e=[]
% generation of symbol
X = randi([0 M-1],nFFT,1); %BPSK symbols
% x1 = de2bi(X,4);
XD = modulate(modObj,X); % normalizing symbol power
x = F'*XD; %loading
xout = [x(nFFT-nCP+1:nFFT);x];
% channel convolution and AWGN y = conv(xout,g); nt =randn(nFFT+nCP+L-1,1) + 1i*randn(nFFT+nCP+L-1,1); No = 10^(-EsNodB(ii)/10); y = y + sqrt(No/2)*nt; % Receiver processing y = y(nCP+1:NT); Y = F*y; R = demodulate(demodObj,Y); % b = de2bi(R,4)
for k=1:kk
R1=R';
X1=X';
%net=newff(minmax(R1), [30,20], {'logsig','purelin', 'trainlm'});
net = feedforwardnet([50 30]);
net=init(net);
net.trainparam.epochs=100;
%net.trainparam.goal=1e-5;
net.trainparam.lr=0.1;
%net.trainparam.min_grad=1e-10;%No. of iterations
%net.trainFcn='trainrp';
net.divideParam.trainRatio = 0.7; % training set [%]
net.divideParam.valRatio = 0.1; % validation set [%]
net.divideParam.testRatio = 0.2; % test set [%]
[net,tr]=train(net,X1,R1);
%x_net = net(y2);
%error=(x2-x_net);
dbstop if error
a1=sim(net,R1);
a=round(a1);
error=(a-X1).^2;
e=[e; error];
end
eav=(mean(mean(e),2))/2;
E=[E;eav];
[n, r(ii)]=biterr(R1,X1); [n1, r1(ii)]=biterr(abs(a),X1); end
toc % Channel estimation figure, semilogy(EsNodB,abs(E/2),'--m','LineWidth',2); hold on legend('MSE'); figure, semilogy(EsNodB,r,'b','LineWidth',2); hold on semilogy(EsNodB,r1,'--r','LineWidth',2); hold on grid on title('Bit Error Rate .VS. Signal To Noise Ratio'); ylabel('BER'); xlabel('SNR [dB]'); legend('withoutNN','withNN');

Antworten (0)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by