Graph Plotting - test question

View: New views
3 Messages — Rating Filter:   Alert me  

Graph Plotting - test question

by Peytonator :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

While attempting the question attached below concerning graph plotting, I became stuck at a few points (being new to Octave). Help would be greatly appreciated!

1) What does the following mean:
     round(10+student)
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)"

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.

Also, slightly unrelated to the question, I have been wondering about the user interface: is it possible to work on something more user friendly than a command line interface?

Any help is much appreciated!

Thanks,

Graham Peyton


Re: Graph Plotting - test question

by A. Kalten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 30 Jun 2008 04:43:57 -0700 (PDT)
Peytonator <graham@...> 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

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: Graph Plotting - test question

by Peytonator :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi AK,

Thanks very much for the help!

I just wanted to ask:

Where did you get the function y=exp(4-2*x). Why did you not use the whole function for current?
Also, what is V(1:20) defining? Do any of these numbers given in the text have to be altered?

Graham