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 8713329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:19:01+00:00 2026-06-13T05:19:01+00:00

I am trying to make my own function in matlab to solve for a

  • 0

I am trying to make my own function in matlab to solve for a system of two nonlinear equations, while using a nested function to share some some parameters, here is a sample code:

function y=solve(a,x0)
a;
y=fsolve(nle,x0);                       % this is line 3

    function f=nle(x)
        f(1)=x(1)-a*x(1)^2-x(1)*x(2);   % this is line 6
        f(2)=2*x(2)-x(2)+3*x(1)*x(2);
    end

end

Here a is the parameter I want to pass from command line to the function, and x0 is the start point for the fsolve.

However, when I call the function in malab after specifying a=4 and x0=[1 1]', it gave me the following error:

Error using solve/nle (line 6)
Not enough input arguments.

Error in solve (line 3)
y=fsolve(nle,x0);

I’m quite a newbie for matlab, can anybody tell me where I am doing wrong?

Thanks in advance.

EDIT:
I tried substituting the nle with a function handle @nle, but seems something else went wrong:

Undefined function 'fsolve' for input arguments of type 'function_handle'.

Error in solve (line 3)
y=fsolve(@nle,x0);

Doesn’t seem to make sense since I checked the documentation for fsolve, and it says it should indeed use a function handle there…

  • 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-06-13T05:19:02+00:00Added an answer on June 13, 2026 at 5:19 am

    You miss the ‘@’ in front of nle, i.e.

     y = fsolve(@nle,x0);
    

    should work.

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

Sidebar

Related Questions

I am trying to make my own confirm dialogs with two parameters. function myAlert(message,
I was trying to make my own class for currencies using longs, but apparently
I've been trying to make my own basic .obj (Wavefront) renderer using the OpenGL
I need some help here. I'm trying to make my own content slider writing
I am trying to create my first own jQuery function to re-order some rows
Hey guys, I'm using smarty and php I am trying to make this function
So I'm trying to make my own strstr function, with the following implemenation: char
I'm trying to make my own filter due to some tutorials in AngularJS. My
Im trying to make my own FormsAuthentication in an ASP.NET MVC 4 application and
So am trying to make my own openID login for my GAE app and

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.