How to estimate a custom model or equation parameters by neural network?
2 次查看(过去 30 天)
显示 更早的评论
hi my friends
i have some concetration kinetic data and calculated reaction rate and must curve fitting by neural network.
i trained my network but by ignored of great error , i should fit on a langmuir hinshelwood model and define K parameters. i need this equation for kinetic reaction to use in process software and CFD calculations.
thanks
clc
clear all
close all
Bz=xlsread('exdata.xlsx','O3:O62');
CHX=xlsread('exdata.xlsx','P3:P62');
H2=xlsread('exdata.xlsx','Q3:Q62');
r=xlsread('exdata.xlsx','R3:R62');
input=[Bz CHX H2 ];
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by Neural Fitting app
% Created 24-Apr-2021 19:15:59
%
% This script assumes these variables are defined:
%
% input - input data.
% r - target data.
x = input';
t = r';
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainbr'; % Bayesian Regularization backpropagation.
% Create a Fitting Network
hiddenLayerSize = 20;
net = fitnet(hiddenLayerSize,trainFcn);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotregression(t,y)
%figure, plotfit(net,x,t)
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Langmuir model %%%%%%%%%%%%%%%%%%%%%%%
function y=rate2(x)
global Pbz Ph2 Pchx r
k1=x(1);
k2=x(2);
Kbz=x(3);
Kh2=x(4);
y=((k1.*Pbz.*Ph2-k2.*Pchx)./(1+Kbz.*Pbz+Kh2.*Ph2))+r;
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!