function [y1] = ANNsteadyNL(x1) %MYNEURALNETWORKFUNCTION neural network simulation function. % % Generated by Neural Network Toolbox function genFunction, 10-Feb-2020 00:17:17. % % [y1] = myNeuralNetworkFunction(x1) takes these arguments: % x = 7xQ matrix, input #1 % and returns: % y = 2xQ matrix, output #1 % where Q is the number of samples. %#ok<*RPMT0> % ===== NEURAL NETWORK CONSTANTS ===== % Input 1 x1_step1_xoffset = [1e-13;1e-13;0.001;0.001;1000;1000;1000]; x1_step1_gain = [20000020.00002;20000020.00002;0.2000200020002;0.2000200020002;2.000000002e-12;2.000000002e-12;2.000000002e-12]; x1_step1_ymin = -1; % Layer 1 b1 = [-0.52167404831945752;-0.61281611271573178;0.26473191999658552;-1.5306093005240415;-0.044589237173141262;-0.10762358999836959;-0.1940721319020785;0.2888828771719848;0.15544402099716881;-0.29742616520874721;-0.88424675095973682;-0.81311847130007686;0.024065721197619294;-0.33057048868499894;-0.06804584885010255;0.11488273032485698;-0.26252503348412998;-0.83528156565218381;-0.027006299317351899;-0.70504793543305444]; IW1_1 = [0.34168782948407239 0.21751823470977588 0.048413441133965535 0.43924443700120314 0.21535470487910707 -0.70025116582784419 0.52948230345574365;0.25572834173135028 0.044263970565104685 0.11661712647595227 0.17443089432378595 -0.72168290501655474 0.27487040435094001 1.0775846946765146;-0.41741141170290402 -0.14166197525889637 -0.40780704183217997 0.053715377620382393 -0.01312163839523264 -0.58181539613704081 -0.18894727441139647;-0.11703144888748704 -0.13177095649082626 -0.11281643377429837 0.211427395440381 -0.94474967735003468 -0.044685615770622869 -1.2759546413280196;-0.19673721590173979 -0.15631987726893942 -0.14572276345053431 0.13336687415043175 -0.70362718990238504 0.052100127449865113 0.54951625890795985;0.30857879820193956 0.18383089956537596 0.099164175442226443 0.067572260442276849 -0.21446646406309555 0.2214619999700824 -0.25214701835414227;0.07489383076906321 -0.028550825733192529 -0.26728948627820459 -0.17779255580987036 -0.17995627554414073 0.41782649005058092 -0.11379151188039337;-0.23947710677509257 -0.19245477543914874 -0.22503004181284167 0.26882670971386652 -0.89056927761522142 -0.19706242045391148 0.35569225841983182;0.067014972511984197 0.0038439625999480598 0.21441975464710453 0.79538507210600817 -0.23597708216607707 0.021096090806353544 -0.47667579336516669;-0.19227233789510775 -0.054742303393531089 -0.2537443313424334 -0.7501018632444888 0.29326797720368669 0.87423630552354259 -0.40617266934694674;-0.26271509047774749 0.12190504571008696 -1.3914438501182744 -1.234885560666797 0.4326685619074262 2.0340496040455549 1.5217192510864395;-0.07451076575729336 0.11255788773379297 -0.094241652195265355 -0.29395363764445459 0.78782516109896439 0.40571702195897685 -1.0872743189081906;0.05051471075875643 0.069653930332443048 -0.43698750657579366 -0.35081778288319199 0.27540440420583634 -0.024700693362842509 0.12223212333859042;-0.0057508858586495688 -0.11132487892860615 -0.11513923205945077 -0.057543770218964278 0.62305421500129621 0.35794366017593066 1.0763807315503751;-0.66210157045378792 -0.25499420274974205 -0.32013691642921671 -0.21246749881916313 -0.86620611179903073 0.045513327852409718 -1.0513071396049971;0.12500524831593771 0.0305746962265671 0.1007251814779016 -0.45913355474076101 -0.17088316318321239 -0.027349089587104462 0.84996342199396269;-0.29210271470764421 -0.052337735720079846 -0.43823329086335483 0.0120375928255797 -0.52746882898996927 0.52286231669130312 -0.39357399185714292;-0.022079120757645013 -0.08936270546545716 -0.014311729794076997 -0.34976277704967718 -0.0054594114319397114 -0.323300082091247 -0.2811713052796771;-0.015039489422026002 -0.0146821687871381 0.13778508769242587 -0.52890575301448217 -0.18466451828494665 -0.36435803953612211 -0.022940243450294016;0.11164125994374308 0.065458190869879987 0.086253076770652345 -0.45985584445423033 0.016557327936345193 0.058208925927636164 -0.2168108923280492]; % Layer 2 b2 = [-0.30952673080977594;0.43701765545845106]; LW2_1 = [-0.039114192111732636 -0.90734214925499412 -0.16317123180896476 -0.66457074450347586 0.53044015106573428 0.37433649621706583 -0.081447759734055131 0.61424829325161345 0.00073387069821551608 -0.0046230014133467594 -0.093555155841158949 -0.1362298521838822 0.0031522092338487268 1.0654329637579223 -0.57052837457747374 -0.74099170155579153 -0.069079709757810151 0.15555784508505888 -0.036669100784737056 0.82831070531642825;-0.64430662895907231 0.73496821471291474 0.42694623894470191 -0.41902140797739745 -0.30712863861686818 0.51117602644362414 -1.0458487073745815 -0.2279478806808303 0.65481766829226651 0.74007981129359035 1.7567174639694785 -1.1074697259952995 0.55334017683964776 -1.0804687511199813 -1.0001334140582967 0.013855128218791866 0.2925625533180603 0.82895674777042516 -0.48457120427410671 -0.269030801493784]; % Output 1 y1_step1_ymin = -1; y1_step1_gain = [3.17141576272296e-12;6.04056452241298e-12]; y1_step1_xoffset = [1.24120572051953e-06;6.41989416059042e-08]; % ===== SIMULATION ======== % Dimensions Q = size(x1,2); % samples % Input 1 xp1 = mapminmax_apply(x1,x1_step1_gain,x1_step1_xoffset,x1_step1_ymin); % Layer 1 a1 = tansig_apply(repmat(b1,1,Q) + IW1_1*xp1); % Layer 2 a2 = repmat(b2,1,Q) + LW2_1*a1; % Output 1 y1 = mapminmax_reverse(a2,y1_step1_gain,y1_step1_xoffset,y1_step1_ymin); end % ===== MODULE FUNCTIONS ======== % Map Minimum and Maximum Input Processing Function function y = mapminmax_apply(x,settings_gain,settings_xoffset,settings_ymin) y = bsxfun(@minus,x,settings_xoffset); y = bsxfun(@times,y,settings_gain); y = bsxfun(@plus,y,settings_ymin); end % Sigmoid Symmetric Transfer Function function a = tansig_apply(n) a = 2 ./ (1 + exp(-2*n)) - 1; end % Map Minimum and Maximum Output Reverse-Processing Function function x = mapminmax_reverse(y,settings_gain,settings_xoffset,settings_ymin) x = bsxfun(@minus,y,settings_ymin); x = bsxfun(@rdivide,x,settings_gain); x = bsxfun(@plus,x,settings_xoffset); end