Path: news.mathworks.com!not-for-mail
From: "rasika " <n.rasika@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Solving eqn in matlab
Date: Wed, 9 Nov 2011 07:24:14 +0000 (UTC)
Organization: Missouri University of Science &#38; Technology
Lines: 84
Message-ID: <j9d9qt$s2a$1@newscl01ah.mathworks.com>
References: <j9ac4r$6b3$1@newscl01ah.mathworks.com> <4EB9281A.9070102@mathworks.com> <90bc76a0-d5d0-49fc-b8a4-9ec56d4079c5@l24g2000yqm.googlegroups.com>
Reply-To: "rasika " <n.rasika@gmail.com>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1320823454 28746 172.30.248.37 (9 Nov 2011 07:24:14 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Nov 2011 07:24:14 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2868390
Xref: news.mathworks.com comp.soft-sys.matlab:748774

Thanks Nasser, I got some roots
ans =
 
                                                596301325.91576234164749415177267
                                                596301325.91576234164749415177148
                                            0.00079574777275045645780180143342736
          802746443.11830032332298137638464*i - 627820992.62821082772870512092314
        - 802746443.11830032332298137638456*i - 627820992.62821082772870512092287
          802746443.11830032332298137638455*i - 627820992.62821082772870512092287
  0.00024589958501577221974263913391303 - 0.00075680110460163359394390295539747*i
 - 0.0004677288053671182188217140940646*i - 0.00064377347139100044864353985062671
   0.0004677288053671182188217140940646*i - 0.00064377347139100044864353985062671
  0.00075680110460163359394390295539747*i + 0.00024589958501577221974263913391303
        - 802746443.11830032332298137638464*i - 627820992.62821082772870512092314
 
>> double(ans)

ans =

  1.0e+008 *

   5.9630          
   5.9630          
   0.0000          
  -6.2782 + 8.0275i
  -6.2782 - 8.0275i
  -6.2782 + 8.0275i
   0.0000 - 0.0000i
  -0.0000 - 0.0000i
  -0.0000 + 0.0000i
   0.0000 + 0.0000i
  -6.2782 - 8.0275i

>> real(ans)

ans =

  1.0e+008 *

    5.9630
    5.9630
    0.0000
   -6.2782
   -6.2782
   -6.2782
    0.0000
   -0.0000
   -0.0000
    0.0000
   -6.2782

What I need is only one answer for one input of Intensity. That way I can process bulk data of intensity. also I need only real values and most of them above 10^8 range, how should I set a loop for that? my data ranges and can range from 100-1000s of points and I cant have 7-8 roots for every value.and sort manually.
Please suggest me a logic./ loop
"Nasser M. Abbasi" <nma%12000.org@gtempaccount.com> wrote in message <90bc76a0-d5d0-49fc-b8a4-9ec56d4079c5@l24g2000yqm.googlegroups.com>...
> On 11/8/2011 8:56 PM, rasika wrote:
> > okay so here is edited code I am trying and it still wont give me a numeric answer..
> > I have taken single single values of Intensity and R as of now, to see atleast
> >if it would work for one single value of them both.. then i will put in them as vectors.
> > syms con
> > A=0.079;
> > B=6*10^-9;
> > C=3.5*10^-10;
> > R=37;
> > Is=260;
> > Intensity=213;
> > v=3.5*10^-10*(50-37)*con-2.5*2*con^3+19*2.5*con^2+58*2.5*(con-1)-2.5 -
> >log((260/213)/(1-(260/213)))+log(6*10^-9)+0.079*(50-37);
> > solve(v,con)
> > it gives out this answer which is obviously not right.
> > ans =
> >
> > snip..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1071410507649966943521088169/(54401661882658312861777920*(((- 4974471010288047340721584908701/81602492823987469292666880000 + 
(pi*i)/10)^2 - 
> 
> 
> I run your code above, and I get (after convert it to double)
> 
> EDU>> double(ans)
> ans =
>   11.7295 - 0.0039i
>    0.9082 + 0.0144i
>   -3.1377 - 0.0104i
> 
> --Nasser