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

15 ビュー (過去 30 日間)
Ryan Sim
Ryan Sim 2018 年 10 月 23 日
編集済み: KSSV 2022 年 10 月 17 日
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 Center および File ExchangeSequence 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