Re: converting table output and plotting
- To: mathgroup at smc.vnet.net
- Subject: [mg49115] Re: converting table output and plotting
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Thu, 1 Jul 2004 05:26:38 -0400 (EDT)
- Organization: The University of Western Australia
- References: <cbu2kr$5i6$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cbu2kr$5i6$1 at smc.vnet.net>,
"seferiad" <seferiad at pacbell.net> wrote:
> Hello,
> I have the following equation:
>
> Table[{v, NSolve[{i == v/r2 + i1, i1==i1(r1+r2)/r2 + a/r2*Log[i1/io +
> 1] - v/r2} /. {r2 -> 200, r1 -> .025, io -> 10^-9, a -> .05}, {i,
> i1}]},{v, 1, 1.2, .1}]//ColumnForm
>
>
> OUTPUT IS:
>
> {1, {{i->.402, i1->.397}}}
> {1.1{{i->1.611,i1->1.60}}}
> {1.2,{{i->3.86, i1->3.85}}}
>
>
> The first terms 1, 1.1,1.2 are Voltage (v) and the second term is
> Current (i), the third term is Current1 (i1).
>
> My objective is to vary my equation above and then create the output
> in such a form that I can directly plot v vs. i, that is "1st term"
> vs. "2nd term". Unfortunately, I don't know how to do this since the
> outputs in the table aren't as I like.
>
> Note: My original approach was to write the transcendental equation in
> a single form whereby, NSolve[ i == function (v, i) ] Unfortunately,
> Mathematica seems to choke on this one. By calculating an additional
> (uninteresting) value (namely, v1), it gives me the output I'm looking
> for. Again, except that I don't know how to convert this into a set of
> numbers that I can plot.
Your set of equations can be solved exactly for i and i1:
solution =
Solve[{i == v/r2+i1, i1==i1(r1+r2)/r2+a/r2 Log[i1/io+1]-v/r2},{i, i1}]
A table of numerical values agrees with those obtained using NSolve:
parameters = {r2 -> 200, r1 -> 0.025, io -> 10^(-9), a -> 0.05};
Table[{v, solution /. parameters}, {v, 1, 1.2, 0.1}]
You can plot the solution v versus i as follows:
ParametricPlot[Evaluate[{i, v} /. solution /. parameters], {v, 1, 2},
AxesLabel -> {i, v}]
(You could just use Plot to visualize i versus v).
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul