COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### fsolve help!!!

• Email
• Follow

```Hello,
I'm trying to solve the following system of nonlinear equations
using fsolve:

***
function F=acrefsolve2(x)
F=[692.4*x(1)^(-0.5)-917-x(3);
135*x(2)^(-0.5)-230-x(3);
7500-x(1)-x(2)];
***

but when I try to call the function using the following:

****
x0=[3500;4000;3];
x=fsolve(@acrefsolve2,x0)
***

I keep getting the following error message:

***
??? Error using ==> feval
Error: File: acrefsolve2.m Line: 12 Column: 1
Function definitions are not permitted in this
context.

Error in ==> fsolve at 254
fuser = feval(funfcn{3},x,varargin{:});

Caused by:
Failure in initial user-supplied objective
function evaluation. FSOLVE cannot continue.
***

Does anyone know what the problem is?  I'm new to MATLAB so I'm
unfamililar with much of the syntax.  I've been using help files
online to get this far.  Any help will be GREATLY appreciated.  Thanks!
```
 0

See related articles to this posting

```Adaora Okwo <asokwo@gmail.com> wrote in message <c7e5baa4-82ff-4acc-a036-86d96413b1f2@30g2000yql.googlegroups.com>...
> Hello,
>   I'm trying to solve the following system of nonlinear equations
> using fsolve:
>
> ***
> function F=acrefsolve2(x)
> F=[692.4*x(1)^(-0.5)-917-x(3);
>     135*x(2)^(-0.5)-230-x(3);
>     7500-x(1)-x(2)];
> ***
>
> but when I try to call the function using the following:
>
> ****
> x0=[3500;4000;3];
> x=fsolve(@acrefsolve2,x0)
> ***
>
> I keep getting the following error message:
>
> ***
> ??? Error using ==> feval
> Error: File: acrefsolve2.m Line: 12 Column: 1
> Function definitions are not permitted in this
> context.
>
> Error in ==> fsolve at 254
>             fuser = feval(funfcn{3},x,varargin{:});
>
> Caused by:
>     Failure in initial user-supplied objective
>     function evaluation. FSOLVE cannot continue.
>  ***
>
> Does anyone know what the problem is?  I'm new to MATLAB so I'm
> unfamililar with much of the syntax.  I've been using help files
> online to get this far.  Any help will be GREATLY appreciated.  Thanks!
- - - - - - - - - -
You can convert your equations to a quartic polynomial equation in x(3).  Using the 'roots' function on this, from each of its real roots (if any) you can determine the corresponding values of x(1) and x(2).  There is no need to use 'fsolve' on this set of equations.

Roger Stafford
```
 0
Reply Roger 10/25/2010 7:09:04 PM

1 Replies
666 Views

Similar Articles

12/6/2013 8:00:06 PM
page loaded in 36300 ms. (0)