How to get Equation of Function developed by ANN (Curve fitting) after training
3 views (last 30 days)
Show older comments
Can I get equation of the function in Curve fitting using Artificial Neural Network after training the inputs and outputs
0 Comments
Accepted Answer
Greg Heath
on 11 Mar 2015
clear all, close all, clc
[ x , t ] = simplefit_dataset;
[ I N ] = size( x ) %[ 1 94 ]
[ O N ] = size( t ) %[ 1 94 ]
MSE00 = mean(var(t',1)) % 8.3378
figure(1), hold on
plot( x, t, 'LineWidth', 2 )
net = fitnet;
rng( 'default' )
[ net tr y e ] = train( net, x, t );
% y = net( x ); e = t - y;
plot( x, y, 'r.' )
NMSE = mse(e)/MSE00 %1.7558e-05
Rsquare = 1 - NMSE % 0.99998
xn = mapminmax(x);
[ tn, tsettings ] = mapminmax(t);
b2 = net.b{2} ;
LW = net.LW{ 2, 1 };
B1 = repmat( net.b{1} , I, N ) ;
IW = net.IW{ 1 ,1 };
yn = b2 + LW * tanh( B1 + IW * xn );
y2 = mapminmax.reverse(yn,tsettings);
dy = max(abs(y-y2)) % 3.5527e-15
Hope this helps.
Thank you for formally accepting my answer
Greg
0 Comments
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!