help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Graph Plotting - test question


From: A. Kalten
Subject: Re: Graph Plotting - test question
Date: Tue, 1 Jul 2008 02:06:22 -0400

On Mon, 30 Jun 2008 04:43:57 -0700 (PDT)
Peytonator <address@hidden> wrote:


> 2) What are steps 3, 4 and 5 actually saying in the code given above?

> 3) Regarding part b, how do I set it to between 2s and 12s? If V(1:20) sets
> for the first 2 seconds, why does the graph come out to have a time range of
> 20 seconds? Basicaly, how do I go about doing part (b)?
> 4) Is a specific time period meant to replace "length(t)"

Follow the procedure exactly as described and you will get a nice
graph or the current (in mA) versus time (seconds).

If you need to find out what each step does, just play with each
step individually and leave out the trailing semicolon ";"

Octave will then display what values are contained in each
variable.  After studying these, the basic methods should
be clear.

> 
> I have read Wikipedia's introduction to Octave and did manage to get some
> kind of a graph of V vs t (as described above), but I am clueless about how
> to begin plotting a graph of coulombs, number of electrons and mAs. 
> 

No graph is needed.  Only the area under the V vs. t plot is required. 

Current = coulombs/time

To determine the amount of charge transferred you need to determine
the definite integral of the current from 2 seconds to 12 seconds.

The function exp(4-2*t) is easy to determine by hand, but octave
has several numerical integration routines.  Check the octave manual
to find out how to use these, but here is the answer anyway:

First define the current function:

function y=f(x)
y=exp(4-2*x);
endfunction

Then determine the numerical integral with quad:

[v,ier,nfun,err]=quad("f",2,12)
v =  5.0000000e-01
ier = 0
nfun =  63
err =  1.4163716e-14

v = 1/2 is the answer.  0.5 milli-coulombs (0.5e-3 coulombs) of charge
has been transferred over this time period (2-12 seconds).

To express this as the number of electrons, just use the relation
6.2421973e+18 electrons = 1 coulomb

0.5e-3 C * 6.2421973e+18 electrons/coulomb = 3.1210986e+15 electrons

AK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]