Path: news.mathworks.com!not-for-mail
From: "Autar " <kaw@eng.usf.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: solve command give z1
Date: Thu, 21 Jul 2011 19:19:09 +0000 (UTC)
Organization: University of South Florida
Lines: 24
Message-ID: <j09u3d$a43$1@newscl01ah.mathworks.com>
References: <ivo1bc$bkd$1@newscl01ah.mathworks.com> <ivod63$aek$1@newscl01ah.mathworks.com> <ivofs9$gm5$1@newscl01ah.mathworks.com> <ivogf1$i3a$1@newscl01ah.mathworks.com> <ivqjrs$ncd$1@newscl01ah.mathworks.com> <j06cr1$nd0$1@newscl01ah.mathworks.com>
Reply-To: "Autar " <kaw@eng.usf.edu>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1311275949 10371 172.30.248.46 (21 Jul 2011 19:19:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 21 Jul 2011 19:19:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 832405
Xref: news.mathworks.com comp.soft-sys.matlab:737083

This is perfect.  It worked.  Straightforward and simple solution.
Autar

"Christopher Creutzig" <christopher.creutzig@mathworks.de> wrote in message <j06cr1$nd0$1@newscl01ah.mathworks.com>...
> "Autar " <kaw@eng.usf.edu> wrote in message <ivqjrs$ncd$1@newscl01ah.mathworks.com>...
> > Thanks for the input.  I found a solution to the problem.  I was not looking for an exact solution but the unique (from the physics of the problem) real solution this problem has.  I wanted to avoid having to use a separate function file to use fzero or fsolve etc. But by using vectorizing, inline and char, we can circumvent the problem.
> 
> Try telling the system you want a real solution, e.g., by assuming that b is real. The following works just fine in 11a:
> 
> clc
> clear all
> a=20
> c=3.2
> theta=[22.8 17.7 15.5 12.9 11.9 10.3 6.6 6.2]; 
> t=[0 5. 10. 15. 20. 25. 45. 60.]; 
> n=length(t);
> syms b real;
> sr=0;
> for i=1:1:n
>     thetapred=a*exp(b*t(i))+c;
>     sr=sr+(theta(i)-thetapred)^2;
> end
> dbsr=diff(sr,b);
> solve(dbsr,b)