approximation using neural networks and genetic algorithm
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi!
I have data (f and N) that I would like to approximate with neural networks - different models for comparison.
Unfortunately, the approximation does not go very well (sometimes bad -test3), I read that using a genetic algorithm to search for weights will help, but I don't know how to do it. The solutions I found did not work.
Thank you for your help.
Code:
f=[0.17;0.48;1.92;2.1;2.25;2.43;2.96;3.86;4.04;4.2;4.37;4.54;4.71;4.87;5.02;5.2;5.36;5.88;6.07;7;7.17;7.49];
N=[-7.27791153646116;-4.29447422767624;-1.31519435701671;-0.420378554933457;1.51876122541888;3.37415903840721;7.37403792249666;24.2818268109931;28.9317522443841;29.8116525599092;35.7158743318026;37.8450891366452;42.8764997674267;42.8847851582810;44.2075712022168;53.8642579111545;58.5925579051624;62.5892730901203;69.0253611093354;69.2368619096259;77.4202507027924;76.2374765137714];
plot(f,N);
hold on
model =["trainlm" "trainscg" "trainbr" "traingda"];
nf = f.';
nN = N.';
net = feedforwardnet(10);
net = configure(net,nf,nN);
for i= 1:4
net.trainFcn = model(1,i);
net1 = train(net,nf,nN);
NN = net1(nf);
NN=NN';
plot (nf,NN)
end
hold off
xlabel('{\it f} [Hz]','FontSize',12); ylabel('{\it N} [mN]','FontSize',12);
legend({'data','net lm','net scg','net br','net gda'}, 'Location','eastoutside');
title('approximation using neural networks','Fontsize',14);
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!