Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7278929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:56:39+00:00 2026-05-28T22:56:39+00:00

I was trying to simulate MATLAB’s NN functions before testing my own coded network.

  • 0

I was trying to simulate MATLAB’s NN functions before testing my own coded network. I was training y = x1+x2.

But see how it performed,

>> net = newfit([1 2 3 4 5 0 1 2 5;1 2 3 4 5 1 1 1 1],[2 4 6 8 10 0 2 3 6],15);

>> net = train(net,[1 2 3 4 5 0 1 2 5;1 2 3 4 5 1 1 1 1],[2 4 6 8 10 0 2 3 6]);

>> sim(net,[1;4])

ans =

   12.1028

>> sim(net,[4;4])

ans =

    8.0000

>> sim(net,[4;1])

ans =

    3.0397

>> sim(net,[2;2])

ans =

    5.1659

>> sim(net,[3;3])

ans =

   10.3024

Can anyone explain what is wrong with these training data? Is it not enough to estimate y = x1+x2 ? Or it just over-specialized? I believe it is a regression problem. Now, I do not know what should I expect from my own coded network. I was wondering on basis of what criteria this NN converges where it is producing such stupid result? is there any way to know what function it maps to (I know no way !)? My own network would not even converge , because it checks sum squared error as loop break condition. So how to deal with such training pattern?

However, I have another awesome training pattern which I am unable to train.

Can anyone train the following data set? Will it work/converge?

0 0 ——-> 0

0 1 ——-> 1000

1000 0 —-> 1

1 1 ——-> 0

I have been using f(x)=x in output layer and used back propagation algorithm , but for this pattern the code never seems converge.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:56:40+00:00Added an answer on May 28, 2026 at 10:56 pm

    By calling

    net = newfit([1 2 3 4 5 0 1 2 5;1 2 3 4 5 1 1 1 1],[2 4 6 8 10 0 2 3 6],15);
    

    you create an ANN with hidden layers of size 15, which is probably too much for your problem. Besides, your training set is too small.

    Here is a working code (it will take a while on old computers), I let you analyze it and diff with yours, please ask should you need further explanations:

    % Prepare input and target vectors
    a = perms(1:9);
    x = a(:, 1);
    y = a(:, 2);
    z = x + y;    
    input = [x y];
    
    % Create ANN
    net = newfit(input',z',2);
    
    % Learn
    net.trainParam.epochs = 1000;
    net = train(net, input', z');
    

    Results are virtually perfect:

    >> sim(net,[1;4])
    
    ans =
    
        5.0002
    
    >> sim(net,[4;4])
    
    ans =
    
        7.9987
    
    >> sim(net,[4;1])
    
    ans =
    
        4.9998
    
    >> sim(net,[2;2])
    
    ans =
    
        4.0024
    
    >> sim(net,[3;3])
    
    ans =
    
        5.9988
    

    PS: NEWFIT is obsoleted in R2010b NNET 7.0. Last used in R2010a NNET 6.0.4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use MATLAB in order to simulate a communications encoding and
I'm trying to simulate a real-time network where nodes are consumers and producers of
I am trying to simulate a a network consisting of several clients and servers.
I'm trying to simulate this error with a sample php code but haven't been
I'm trying to simulate the InstallURL property of a VS.net install MSI... I've got
I am trying to simulate n times the measuring order and see how measuring
I'm trying to simulate a particle system using OpenGl but I can't get it
I'm trying to simulate the same origin policy with my own laptop for researching
I'm trying to simulate a substring in Python but I'm getting an error: length_message
I'm trying to simulate a floating modal box type thing but having an issue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.