i cant simulate my network, Error using network/sim Input data sizes do not match net.inputs{1}.size.

Hi,
I can't simulate a simple network, for example
% my input is x, and my output is y
x = [1:50];
y = 2*x;
% create the network
net = fitnet(10);
% train the network on x & y
train(net,x,y)
% so far things are ok! now let's simulate
xnew = 2.5;
ynew = sim(net,xnew);
%at this point i get the error
Why this happens? i above statements used to work fine 2 years ago when i used MATLAB, but now everytime i get the error below:
Error using network/sim
Input data sizes do not match net.inputs{1}.size.
Even if I use my input (x) into the sim command >> ynew = sim(net,x), i would still get this error.
Thanks,

回答 (1 件)

Ahmed Ghamdi
Ahmed Ghamdi 2022 年 7 月 16 日
i found the mistake,
for training, instead of writing
ThemeCopy
train(net,x,y)
i should write
ThemeCopy
[net,tr] = train(net,x,y)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

リリース

R2022a

タグ

質問済み:

2022 年 7 月 15 日

回答済み:

2022 年 7 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by