Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: solution of a transcendental equation
Date: Wed, 16 Jan 2008 20:58:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 69
Message-ID: <fmlr4q$bfd$1@fred.mathworks.com>
References: <9544552.1200342600658.JavaMail.jakarta@nitrogen.mathforum.org> <22495104.1200504568448.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1200517082 11757 172.30.248.37 (16 Jan 2008 20:58:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 16 Jan 2008 20:58:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:446026


Fulya <fulya_bagci@yahoo.com> wrote in message 
<22495104.1200504568448.JavaMail.jakarta@nitrogen.mathforum.org>...
> OK. I used 'fsolve'.
> 
> I do least squares fitting of this function.It gives such an error and although 
the fit is good when I enter good initial parameters, it is not smooth and it 
gives what I write as the initial parameters.Error:
> 
> Conditioning of Gradient Poor - Switching To LM method
> Optimization terminated: search direction less than TolX.
> 
> my code is
> .
> funi = @(y) mean(abs(y-a.*abs(Fsat+K.*y.*x)./ (Fsat+K.*x)).^(1-1./K));
> %yd is experimental y, yi is the theoretical y
> yi  = fsolve(funi,yd);
> .
> val = yd - yi
> 
> second window:
> read experimental x and yd data
> [solution]=lsqnonlin(@OAOLmyLu,[8.0,3.0])
> plot(x,yd)
> plot(x,yi)
> 
> I thank individually to whow writes to me.
----------
  Fulya, I don't understand how your function 'funi' in this second article 
relates to the original implicit function you defined in your first article:

 y=a*((b+c*y*x)/(b+c*x))^(1-1/c)

Presumably 'Fsat' refers to 'b' and 'K' to 'c'.  However, in this second article the 
exponent, (1-1/c), operates on the difference between the two sides of the 
equation, rather than simply to the fraction (b+c*y*x)/(b+c*x).  Your 'funi' is 
also not the same as John's 'funi' or his 'fun'.  How do you account for the 
differences here?

  Also you don't state anywhere whether quantity 'a' is less than or greater 
than 1.  This makes a very important difference to the appearance of the x-
versus-y curve.  Also you don't state whether you are interested in the 
portion where y > a or that where y < a.  These are two separate pieces of the 
curve.  What kinds of values are you using for a, b, and c?

  As I mentioned earlier, x can be expressed as a function of y:

 x = b/c*(t-1)/(y-t)

where

 t = (y/a)^(c/(c-1)).

(Very likely you intend for y and a to both be positive quantities so as to get a 
real value for t here.)  You should try plotting this function from y ranging 
from 0 up to something well above y = a to get a feeling for what you are 
dealing with.  You will be able to see the difference between the cases where 
a > 1 and a < 1, as well as noting the asymptotes at y = 0 and y = a.

  If I were doing this problem (after doing some plotting) I would first use 
'fzero' to solve it, before attempting to use 'fsolve'.  Though 'fzero' can only 
deal with scalar solutions one at a time, it is much simpler in concept than 
'fsolve' and would allow you to better understand the problem you are dealing 
with.  After that you could try for better run time efficiency with 'fsolve'.  You 
should note that the results John got with 'fzero' gave solutions that appear 
to be as accurate as matlab's double is capable of - that is, errors only out at 
the least bit.

Roger Stafford