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

12 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Greg Heath
Greg Heath il 19 Dic 2018
Modificato: KSSV il 17 Ott 2022
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)

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by