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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:11:31+00:00 2026-06-16T00:11:31+00:00

I want to solve two nonlinear equations in MATLAB so i did the following:

  • 0

I want to solve two nonlinear equations in MATLAB so i did the following:

part of my script

c=[A\u;A\v];
% parts of code are omitted.
x0=[1;1];
sol= fsolve(@myfunc,x0);

the myfunc function is as follows

function F = myfunc(x)

  F=[ x(1)*c(1)+x(2)*c(2)+x(1)*x(2)*c(3)+c(4)-ii;

     x(1)*c(5)+x(2)*c(6)+x(1)*x(2)*c(7)+c(8)-jj];

end

i have two unknowns x(1) and x(2)

my question is How to pass a values(c,ii,jj) to myfunc in every time i call it?

or how to overcome this error Undefined function or method 'c' for input arguments of type 'double'.

thanks

  • 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-16T00:11:32+00:00Added an answer on June 16, 2026 at 12:11 am

    Edit: The previous answer was bogus and not contributing at all. Hence has been deleted. Here is the right way.

    In your main code create a vector of the coefficients c,ii,jj and a dummy function handle f_d

    coeffs = [c,ii,jj];
    f_d = @(x0) myfunc(x0,coeffs);      % f_d considers x0 as variables
    sol = fsolve(f_d,x0);
    

    Make your function myfunc capable of taking in 2 variables, x0 and coeffs

    function F = myfunc(x, coeffs)
    c = coeffs(1:end-2);
    ii = coeffs(end-1);
    jj = coeffs(end);
    
    F(1) = x(1)*c(1)+x(2)*c(2)+x(1)*x(2)*c(3)+c(4)-ii;
    F(2) = x(1)*c(5)+x(2)*c(6)+x(1)*x(2)*c(7)+c(8)-jj;
    

    I think that should solve for x0(1) and x0(2).

    Edit: Thank you Eitan_T. Changes have been made above.

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

Sidebar

Related Questions

I want two create 2 sections uitableview so I did the following code -
I want to solve the following optimization problem: Non-Latex: Given x and mu, find
I want to solve a system of n linear equations containing n variables using
In my android application I want to solve the following scenario. class Login extends
I have the following problem that I want to solve in awk. I have
I want to compare two floats in PHP, like in this sample code: $a
Lets say I want to map the following two classes: public class A {
I want to solve this linear programming (simplex) problem using MATLAB 7, but it
I have a following problem I want to solve efficiently. I am given a
I want to solve x. How can I do it in Scheme? T1-F2=0 F1+T2=GM-Gm

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.