I am taking one of the o/ps ( i.e. sol_fsolve ) as x & y values that has lesser value (i.e. min. of value(:,1) and value(:,2) ).

But, i am getting the final x & y values as : 8.9830e+000 & 1.7937e+001 where as the original x & y values that i should get are : 8.7616e+000 & 2.0232e+001.

That means there is difference in the x & y values that i am supposed to get. This indicates that i am not making the initial guess properly. Can anyone tell me how to make the initial guess for x & y values ? ( with out plotting ezsurf because plotting the surfaces takes long time ).

Please please suggest some thing on how to make the initial guess for fsolve ? Am i doing some thing wrong in the above code ?

If your system of agebraic equations has multiple zeros, then, depending on your
initial guess, fsolve will produce different solutions.
Did you check whether both "solutions" satisfy f(x,y)=g(x,y)=0 ?
If this is the case, there is little chance to adjust the initial guess such that the solver converges to the solution that you qualify as "correct".
If this is not the case, you will have to find out why this is so.

When i take like this, some times i am getting correct values. But, some times, i am getting as : " Out of memory. HELP MEMORY for your options " . I have to look for some other way to circumwent this problem.

"kalpana " <naidukalpana@yahoo.co.in> wrote in message <kvn4vj$imv$1@newscl01ah.mathworks.com>...
>
> For X = -2 : 0.2 : 1000 & Y = -2 : 0.2 :1000, i have calculated f1(X,Y) & f2(X,Y) values.
> I checked the min(f1) and min(f2) values. They are coming around 10^(-4) & 10^(-6). But, still the initial guess taken is coming as wrong. May be, i have to further increase the X range and Y range for calculating f1(X,Y) & f2(X,Y) values . This is something like : X = -2 : 0.02 : 1000 & Y = -2 : 0.02 :1000.
>
> When i take like this, some times i am getting correct values. But, some times, i am getting as : " Out of memory. HELP MEMORY for your options " . I have to look for some other way to circumwent this problem.
>
> Thank you for your answer.
>
> With best regards,
> kalpana

What is the result when you evaluate
f1(8.9830e+000,1.7937e+001), f2( 8.9830e+000,1.7937e+001)
and
f1(8.7616e+000,2.0232e+001), f2(8.7616e+000,2.0232e+001)
?

"Torsten " <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message
news:kvn673$72j$1@newscl01ah.mathworks.com...
> "kalpana " <naidukalpana@yahoo.co.in> wrote in message
> <kvn4vj$imv$1@newscl01ah.mathworks.com>...
>>
>> For X = -2 : 0.2 : 1000 & Y = -2 : 0.2 :1000, i have calculated f1(X,Y) &
>> f2(X,Y) values. I checked the min(f1) and min(f2) values. They are coming
>> around 10^(-4) & 10^(-6). But, still the initial guess taken is coming as
>> wrong. May be, i have to further increase the X range and Y range for
>> calculating f1(X,Y) & f2(X,Y) values . This is something like : X = -2 :
>> 0.02 : 1000 & Y = -2 : 0.02 :1000. When i take like this, some times i am
>> getting correct values. But, some times, i am getting as : " Out of
>> memory. HELP MEMORY for your options " . I have to look for some other
>> way to circumwent this problem. Thank you for your answer.
>>
>> With best regards,
>> kalpana
>
> What is the result when you evaluate
> f1(8.9830e+000,1.7937e+001), f2( 8.9830e+000,1.7937e+001) and
> f1(8.7616e+000,2.0232e+001), f2(8.7616e+000,2.0232e+001)
> ?

That's the wrong question to ask. The correct question is, when you run your
code like:

Sometimes the digits that don't print using FORMAT SHORT can be significant.
Using the contents of the variables instead of the displayed values of the
variables avoids that problem.

To the OP, if that doesn't resolve the problem, post a SMALL description of
your f1 and f2 functions. If they're "well behaved" then you may just need
to relax your tolerance. Instead of using a tolerance of 1e-10 on the
function value, try more like 1e-6 or 1e-7. If your function is something
oscillatory or "poorly behaved" then you may have problems. For instance,
trying to find a solution to this:

These f1 & f2 function values clearly tell me that i am missing out the initial guess for fsolve command.

If you know, please tell me how to make the correct initial guess for fsolve .

Sorry if it is consuming your time and thank you very much again for spending your time for my problem.

With best regards,
kalpana

"Steven_Lord" <slord@mathworks.com> wrote in message <kvnjve$efk$1@newscl01ah.mathworks.com>...
>
>
> "Torsten " <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message
> news:kvn673$72j$1@newscl01ah.mathworks.com...
> > "kalpana " <naidukalpana@yahoo.co.in> wrote in message
> > <kvn4vj$imv$1@newscl01ah.mathworks.com>...
> >>
> >> For X = -2 : 0.2 : 1000 & Y = -2 : 0.2 :1000, i have calculated f1(X,Y) &
> >> f2(X,Y) values. I checked the min(f1) and min(f2) values. They are coming
> >> around 10^(-4) & 10^(-6). But, still the initial guess taken is coming as
> >> wrong. May be, i have to further increase the X range and Y range for
> >> calculating f1(X,Y) & f2(X,Y) values . This is something like : X = -2 :
> >> 0.02 : 1000 & Y = -2 : 0.02 :1000. When i take like this, some times i am
> >> getting correct values. But, some times, i am getting as : " Out of
> >> memory. HELP MEMORY for your options " . I have to look for some other
> >> way to circumwent this problem. Thank you for your answer.
> >>
> >> With best regards,
> >> kalpana
> >
> > What is the result when you evaluate
> > f1(8.9830e+000,1.7937e+001), f2( 8.9830e+000,1.7937e+001) and
> > f1(8.7616e+000,2.0232e+001), f2(8.7616e+000,2.0232e+001)
> > ?
>
> That's the wrong question to ask. The correct question is, when you run your
> code like:
>
> solution = fsolve(...)
>
> what is the result you receive when you execute:
>
> functionValues = [f1(solution(1), solution(2)), f2(solution(1),
> solution(2))]
>
> Sometimes the digits that don't print using FORMAT SHORT can be significant.
> Using the contents of the variables instead of the displayed values of the
> variables avoids that problem.
>
> To the OP, if that doesn't resolve the problem, post a SMALL description of
> your f1 and f2 functions. If they're "well behaved" then you may just need
> to relax your tolerance. Instead of using a tolerance of 1e-10 on the
> function value, try more like 1e-6 or 1e-7. If your function is something
> oscillatory or "poorly behaved" then you may have problems. For instance,
> trying to find a solution to this:
>
> http://www.mathworks.com/matlabcentral/fileexchange/35311-matlab-plot-gallery-surface-contour-plot/content/html/Surface_Contour_Plot.html
>
> is probably going to lead you in circles (literally.)
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

I got correct solution. But, this code is taking relatively long time when compared to guessing the initial value for fsolve and then using the fsolve function.

Is there any way to reduce the time taken for solving the f1 and f2 functions using the contour method ? ( I have to check if i get the correct solution for other problems also using the contour method and how much time it takes for solving).

Thank you for whatever suggestions i got until now.
Also, Please suggest on how we can reduce the time taken for solving the equations f1(x,y) = 0 and f2(x,y) = 0.

When I give a relative precision of eps=1.5e-8 for my fsolve-like solver and start with initial guess x=1, y=1, I automatically arrive at the correct solution
x=445.518284, y=845.973029.
So I can't give advice what's going wrong here.