function experiment %determination of reaction rate for crystal growth from aqeous solutions %save this file as mfile to run in matlab % inputs are dc, rpm, dp, temp, rg %normalized inputs are given by Dc/20,rpm/400,dp,rg*1000 input = [0.900045311 0.850043781 0.800087421 0.750019169 0.700028638 0.65003094 0.600051464 0.550052882 0.500032868 0.450031839 0.400017616 0.900078827 0.850052872 0.800097926 0.750014569 0.700040523 0.65000618 0.600035508 0.550030326 0.500053633 0.450021568 0.950058968 0.900036807 0.850016683 0.800046281 0.750041401 0.700027348 0.650073741 0.600015053 0.550058262 0.500005224 0.450003183 0.40004627 0.900041798 0.850029311 0.800061212 0.750004561 0.700025224 0.650072004 0.600005722 0.550076663 0.500031258 0.450037471 0.400004301 0.900085361 0.850054436 0.800075273 0.750024407 0.70011423 0.650111898 0.600084301 0.550021222 0.500065785 0.450017353 0.400022541 0.95009469 0.900075766 0.850015329 0.800048421 0.750080179 0.700031782 0.650038196 0.600010359 0.550060478 0.500009399 0.450042121 0.900033144 0.850029334 0.800089605 0.750028696 0.700013352 0.650000447 0.600049071 0.550088123 0.500066065 0.450057211 0.400056284 0.90003767 0.850075555 0.800044227 0.750056071 0.700047086 0.650039756 0.600045823 0.550064365 0.500043599 0.450001693 0.400007761 0.947136219 0.900039341 0.850039942 0.800043483 0.750027387 0.700008659 0.650035049 0.600008549 0.55001934 0.500007395 0.450018292 0.400011997 0.350001561 0.92398626 0.900152198 0.850015434 0.800035162 0.750011096 0.700048794 0.650119072 0.600041123 0.550043248 0.500022476 0.45000688 0.400018521 0.373641323; 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.75 0.75 0.75 0.75 0.75 0.75 0.75 0.75 0.75 0.75 0.75 1 1 1 1 1 1 1 1 1 1 1 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625; 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.07088 0.07088 0.07088 0.07088 0.07088 0.07088 0.07088 0.07088 0.07088 0.07088 0.07088 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184; 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1 1 1 1 1 1 1]; %normalized target is given by rg*1000 target=[0.586881752132946 0.497724675211997 0.441969563072223 0.390702562868991 0.342290431189180 0.301507430040278 0.261605279420230 0.219681638780439 0.177525083407579 0.137221988837990 0.091453974856195 0.674192282188662 0.568609242084542 0.488669609489998 0.434624306685732 0.377177381035452 0.334348219330841 0.295432968105673 0.250784513255421 0.206663920225938 0.157218235654358 0.898021426814809 0.688709176139550 0.593660389913298 0.518273050268273 0.467584398276636 0.422386548962463 0.368635259704099 0.332146987729259 0.285447225127710 0.242281788755245 0.184410609576556 0.131029385547087 0.630490640566574 0.520768840170616 0.483185467327212 0.462453397861048 0.440445905055517 0.381949221810470 0.337402144745992 0.291922979810380 0.243272779600021 0.191063588180464 0.141627150231091 0.804228880950062 0.675413130353109 0.584724002966957 0.532139237999268 0.485630200853976 0.432489055263579 0.394891733007953 0.341802909118604 0.287362804767845 0.229750610910781 0.175499216722282 0.310866018786595 0.234810404055919 0.199783720800070 0.174245758676327 0.156761056745877 0.136935989376632 0.120301369902926 0.107815344040041 0.091935016527195 0.076815896545410 0.060556710316550 0.740764736158475 0.629399231509792 0.539097229965586 0.472078996783694 0.431267582926293 0.374235214668404 0.329876748615853 0.282840890494955 0.238631690731717 0.187700647682211 0.142297850834563 1.015163312694240 0.866043026725307 0.747991230014243 0.656015000567104 0.587711949208396 0.520373300383549 0.460945138774777 0.403519680994158 0.328187488280960 0.268431033653582 0.195513056044595 0.446951973515169 0.281784547678459 0.234176576884461 0.214809344834097 0.183491219945897 0.170999932274366 0.148755157679827 0.120433801721394 0.096594749426642 0.069452052793637 0.057546388301159 0.041907427766188 0.040808551660468 1.155579123505110 1.047271558585880 0.869501770853259 0.724108849197606 0.606950572825248 0.507675201543773 0.422585400491946 0.345687528100719 0.255053099360127 0.175507006943277 0.094504709316731 0.038165881857560 0.024731324877138] %target1=1000*target %net = newff( minmax(input), [10 1], {'tansig', 'purelin', 'trainbr', 'trainlm'} ) %above command train network using a leverberg marquardt strategy;%refer to command in line 15; % remove the percentage in line 15 to activate the command %alternatively a bayesian regularization in combination with levenberg marquardt algorithm can be used as follows; %both trainbr and trainlm are tried initially; %trainlm was used with early stopping to avoid overfitting net = newff( minmax(input), [10 1], {'tansig', 'purelin'}, 'trainbr') net.trainParam.epochs=3000;%(number of epochs) %net.trainParam.lr=0.3;%(learning rate) %net.trainParam.mc=0.6;%(momentum) net=train(net,input,target) output = sim(net, input) [target1,output] plot(target1, 'o') hold on plot(output, '+r') [output]' validationset1=[0.947136219 0.894562956 0.837895473 0.780051308 0.722078824 0.664903669 0.63908421 0.569320886 0.517574646 0.478792805 0.413454477 0.357348907 0.332760288 0.283211443 0.913242002 0.889185144 0.839002081 0.789330139 0.739922305 0.690640155 0.641516423 0.592461499 0.543885331 0.495457321 0.447212149 0.398496493 0.960365624 0.925100595 0.875008899 0.825010349 0.775106244 0.725102144 0.675069857 0.625013753 0.575033716 0.525082952 0.475072979 0.904135974 0.902008285 0.851064924 0.800048421 0.749112056 0.699509448 0.650739887 0.603219762 0.555245048 0.509690165 0.464622834 0.420297146 0.951386619 0.895336367 0.845189655 0.795297662 0.745246551 0.695165714 0.645381077 0.595643216 0.546083521 0.496471452 0.447027815 0.397647179 0.945117954 0.914436635 0.871343803 0.828675856 0.785939326 0.744032491 0.702841568 0.66146318 0.620374284 0.577878625 0.534014139; 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375 0.375; 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.01885 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05498 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362 0.05362; 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1 1 1 1 1 1 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8] validationset2=[0.942520227 0.942470787 0.94242135 0.942371913 0.841963099 0.84180187 0.841640648 0.841479434 0.841318226 0.927055934 0.926935476 0.926814957 0.926694439 0.926573859 0.926453219 0.926332518 0.716537671 0.716444857 0.716352045 0.716259233 0.716166422 0.716073551 0.585355539 0.585263637 0.585171796 0.585080016 0.584988237 0.584896459 0.871066347 0.870963494 0.870860641 0.870757789 0.870654938; 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 0.625 1 1 1 1 1 1 1 0.375 0.375 0.375 0.375 0.375 0.375 0.5 0.5 0.5 0.5 0.5 0.5 0.625 0.625 0.625 0.625 0.625; 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.0536184 0.01885 0.01885 0.01885 0.01885 0.01885; 0.6 0.6 0.6 0.6 1 1 1 1 1 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8]; y=sim(net,validationset1) rgvalidationset1=[y]'/1000 z=sim(net,validationset1) rgvalidationset2=[z]'/1000