Skip to main content
. 2021 Jun 30;18(13):6991. doi: 10.3390/ijerph18136991
% entering input data i.e., fabric property thickness
x = [ 0.37 0.41 0.48 0.49 0.47 0.37 0.41 0.48 0.49 0.47 0.37 0.41 0.48 0.49 0.47 0.37 0.41 0.48 0.49 0.47 0.37 0.41 0.48 0.49 0.47 0.37 0.41 0.48 0.49 0.47];
% entering output data i.e., protective performance HTP
t = [ 5.97 7.01 7.48 6.39 7.61 20 20 11.62 6.08 11.5 20 20 10.16 6.9 15.32 13.14 15.47 8.42 13.71 7.87 20 20 13.07 13.88 12.73 20 20 17.39 13.96 18.52];
% Choose a Training Function
trainFcn = ‘trainlm’; % Levenberg-Marquardt backpropagation. ‘trainlm’ is usually fastest.
% Create a Fitting Network
hiddenLayerSize = 1;% number of hidden neurons.
nethtp = fitnet (hiddenLayerSize,trainFcn);
% Setup Division of Data for Training, Validation, Testing
nethtp.divideParam.trainRatio = 70/100;
nethtp.divideParam.valRatio = 15/100;
nethtp.divideParam.testRatio = 15/100;
nethtp.trainParam.epochs=3000;% number of training epochs.
% Train the Network
[nethtp,tr] = train (nethtp,x,t);
% Test the Network
y = nethtp (x);
e = gsubtract (t,y);
performance = perform (nethtp,t,y)
% View the Network
view (nethtp)
% calculating the root mean square error
rmse=sqrt (performance);
% Plots
figure, plotperform (tr)
figure, plottrainstate (tr)
figure, ploterrhist (e)
figure, plotregression (t,y)
% using the regression analysis to judge the network performance
[m,b,r]=postreg (y,t);
% saving the trained network
save nethtp;