trainFcn_2nd ='trainlm'; net_2nd=feedforwardnet(number_hidden,trainFcn_2nd); net_2nd=configure(net_2nd,inputs,targets);
[a, b]=min(ybest);
xo=xbest(b,:); k=0;
% Setup global best for weight and bias in neural network
% inputlayers*hiddenlayers xi=zeros(number_hidden,number_input); for i=1:number_hidden
for j=1:number_input k=k+1; xi(i,j)=xo(k);
end end
% outputlayers*hiddenlayers xl=zeros(number_output,number_hidden); for i=1:number_hidden
for j=1:number_output k=k+1; xl(j,i)=xo(k);
Có thể bạn quan tâm!
- N. M. Nawi, R. Ransing, And M. Ransing. An Improved Conjugate Gradient Based Learning Algorithm For Back Propagation Neural Networks. International Journal Of Computational Intelligence. 2007,
- Chẩn đoán dầm cầu bằng phương pháp phân tích dao động trên mô hình số hoá kết cấu được cập nhật sử dụng thuật toán tối ưu hoá bầy đàn kết hợp mạng nơ ron nhân tạo - 17
- Chẩn đoán dầm cầu bằng phương pháp phân tích dao động trên mô hình số hoá kết cấu được cập nhật sử dụng thuật toán tối ưu hoá bầy đàn kết hợp mạng nơ ron nhân tạo - 18
Xem toàn bộ 154 trang tài liệu này.
end end
% hiddenlayers xb1=zeros(number_hidden,1); for i=1:number_hidden
k=k+1; xb1(i,1)=xo(k);
end
% outputlayers xb2=zeros(number_output,1); for i=1:number_output
k=k+1;
xb2(i,1)=xo(k); end
% Chose your train function in ANN trainFcn ='trainlm';
net_2nd = feedforwardnet(number_hidden,trainFcn); net_2nd = configure(net,inputs,targets);
net_2nd = fitnet(number_hidden,trainFcn);
% Close train window net_2nd.trainParam.showWindow = 1;
% Train
[net_2nd] = train(net_2nd,inputs,targets); outputs_2=net_2nd(inputs); error_2=outputs_2 - targets;
err_2nd = mean(error_2.^2)/mean(var(targets',1)) x=inputs;
t = targets;
y = net_2nd(x);
perf3 = perform(net_2nd,t,y)
% This line will caculate for 2 outputs err_2nd=norm(err_2nd);
disp (['the differen between output and target is: ' num2str(err_2nd)]) disp (['Epoch --------------------------- ' num2str(epoch)])
if err_2nd < err_1st
disp ('complete model')
break %Terminate execution of for or while loop else
weight_bias = getwb(net_2nd); end
end
disp('Complete Final model net_f') toc;
%% Test
disp('Testing out put....')
% Test for all value in used data Test_ouputs1=net_2nd(inputs); Test_ouputs1 = [Test_ouputs1; targets]; nntraintool('plot','plotregression')
set(findall(gcf,'-property','FontSize'),'FontSize',10) for i1 = 1:4
subplot(2,2,i1) grid on
end nntraintool('plot','plotperform')
set(findall(gcf,'-property','FontSize'),'FontSize',10) grid on;
nntraintool('plot','plottrainstate')
set(findall(gcf,'-property','FontSize'),'FontSize',10) grid on;
nntraintool('plot','ploterrhist')
set(findall(gcf,'-property','FontSize'),'FontSize',10) grid on;
timeElapsed = toc
Dầm trong phòng thí nghiệm
clear all;
% materials
E = 1.96E11; poisson = 0.30;
% E = 1.82095E11; poisson = 0.30;
% matriz C
C=E/(1-poisson^2)*[1 poisson 0;poisson 1 0;0 0 (1-poisson)/2];
% % load
% P = 1e6;
rho=7810; thickness=15e-3;
% thickness=6e-3;
%Mesh generation Lx=800e-3;
Ly=50e-3;
% Lx=0.6; % hauteur de la section droite de la poutre
% Ly=38e-3; % largeur de la section droite de la poutre L=Lx;
B=Ly;
numberElementsX=101; numberElementsY=1; Nx=numberElementsX; Ny=numberElementsY;
numberElements=numberElementsX*numberElementsY; [nodeCoordinates, elementNodes] = MeshRectangular(L,B,Nx,Ny);
% rectangularMesh(Lx,Ly,numberElementsX,numberElementsY); xx=nodeCoordinates(:,1);
yy=nodeCoordinates(:,2);
% drawingMesh(nodeCoordinates,elementNodes,'Q4','k-'); numberNodes=size(xx,1);
% GDof: global number of degrees of freedom GDof=2*numberNodes; [stiffness,mass]=formStiffness2D(GDof,numberElements,...
elementNodes,numberNodes,nodeCoordinates,C,rho,thickness); [Val_prop_Range,Indice] = sort(diag(Val_prop)); % définition de l'ordre des indices Vect_prop_range = Vect_prop(:,Indice); % Matrice ordonnée (Vecteurs propres) K_range=stiffness;
M_range=mass;
Puls_prop = Val_prop_Range.^(1/2) ;% Pulsation propre (en rad/s) freqHz = Puls_prop/(2*pi) ; % UNITS : Hertz freqHzz=freqHz(4:10,:)
Cầu Bến Quan
clc; close all;
% bvib manual
% Tutorial: static analysis
% Units: m, kN
% Nodes=[NodID X Y Z] lspan = 12;
%dy = 0.0001; %m, distance between nodes at a truss joint b=0;
% reference node
% Check the node coordinates as follows: figure
plotnodes(Nodes);
Element types -> {EltTypID EltName}
% Sections=[SecID A ky kz Ixx Iyy Izz yt yb zt zb] Sections=[1 A inf inf 0 0 Izz yt yb b/2 b/2];
% 2 pi*r^2 NaN NaN NaN NaN NaN NaN NaN NaN NaN];
% Materials=[MatID E nu]; E=2E11;
Materials= [1 E 0.3 7850] Code=1;
% Elements=[EltID(ten phan tu) TypID SecID MatID n1 n2 n3)] Elements=Elements_Sources_beam_Benquan(Code);
figure; plotnodes(Nodes,'numbering','off'); hold('on')
plotelem(Nodes,Elements,Types,'numbering','on'); DOF=getdof(Elements,Types);
seldof = [0.01;0.04 [Edge4]+0.02 [Edge4]+0.03 [Edge4]+0.05
[Edge1;Edge3]+0.05 Edge2+0.03 Edge2+0.05];
DOF=removedof(DOF,seldof); [K,M]=asmkm(Nodes,Elements,Types,Sections,Materials,DOF);
% bvib manual
% Tutorial: dynamic analysis: eigenvalue problem
% Units: m, N
% Assembly of M and K
% Eigenvalue problem nMode=20; [phi,omega]=eigfem(K,M,nMode);
% Display eigenfrequenties
% disp('Lowest eigenfrequencies [Hz]'); a=omega/2/pi;
idx=[1 2 3 4];
figure; plotdisp(Nodes,Elements,Types,DOF,phi(:,1),'DispMax','off') figure; plotdisp(Nodes,Elements,Types,DOF,phi(:,2),'DispMax','off') figure; plotdisp(Nodes,Elements,Types,DOF,phi(:,3),'DispMax','off') figure; plotdisp(Nodes,Elements,Types,DOF,phi(:,4),'DispMax','off') fre_FEM=a(idx)