Why is there a error message that says the numbers of input signals and networks inputs do not match?

조회 수: 16 (최근 30일)
Below is a copy of my code and I couldn't manage to get it to configure properly because of the error message. When I run the code it says the numbers of input signals and networks inputs do not match. Some help much appreciated.
x = linspace(0,10,100);
z1 = [0.001 1 1.5 2 2.335 2.5 3 4 5 6 7 8 10];
invx = 1./x;
invz = 1./z1;
z = [z1;invz];
t = Mg(z1,invz);
net = feedforwardnet;
net.numinputs = 2;
net.numLayers = 1;
net.inputConnect = [1 1];
net = configure(net,z,t);
NOTE: Mg is a separate file of some function of R and inverse R.
Thank you Greg for the comment, I apologise for the error, below is a copy of Mg.m file.
function value = Mg(r,inverseR)
B = 3.82045;
b = 1.31633;
beta = 2.17316;
C = -0.19641;
Rc = 2.30156;
c = 0.61347;
gamma = 1.79411;
D = 0.00082;
Rd = 1.83495;
d = 0.74887;
delta = 1.86846;
value = (-2.*inverseR).*(tanh(r)) + B.*(exp(-(r./b).^beta)) + C.*(exp(-(abs((r-Rc)./c).^gamma))) + D.*(exp(-(abs((r-Rd)./d).^delta)));
end

답변 (1개)

Greg Heath
Greg Heath 2018년 12월 19일
편집: KSSV 2022년 10월 17일
See my attachment
Note that typically, all you have to define is the input and target.
Use of CONFIGURE is UNNECESSARY
It can be as simple as this
See HELP FITNET
[ x, t ] = simplefit_dataset;
[ net tr y e ] = train( fitnet ,x, t );
MSE = mse(e)

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by