[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: extractive variables to files

**From**: |
Ivan Sutoris |

**Subject**: |
Re: extractive variables to files |

**Date**: |
Fri, 20 Mar 2009 17:13:57 +0100 |

On Thu, Mar 19, 2009 at 5:44 PM, Jim Maas <address@hidden> wrote:
>* Apologies for syntax questions here. I have googled and made attempts*
>* .... still no luck!*
>
>* Ben has helped me get an initial script to run, will list it at bottom.*
>* Could someone show me how to*
>
>* 1. extract the values of the variables "ca" and "out" such that I can*
>* store them in a data file with their appropriate independent*
>* values of "t" ?*
>* 2. plot the same values of "ca" and "out" vs "t"/*
>* 3. What does the "@" sign stand for here ...I've dug around and*
>* googled both octave and matlab and can't find it!*
>
>* Thanks*
>
>* Jim*
If I understand correctly what you want to do:
1. after you run your script, you have vectors "t" and "y" as output
from ode45. Then you can compute "ca" and "out" from y like this: (the
dot before slash operator means that division will be done
element-wise)
ca = y ./ sz;
out = vmax ./ (1+km ./ ca);
You could also use already defined function qaout: "[out,ca] =
qaout(t,y,vmax,km,sz)", but you would need to change "/" to "./" as
above, so that the function can accept vector y.
You can save variables to file with save command:
save myfile.dat t ca out
will save variables t, ca, out to myfile.dat (this will use Octave's
own format - see "help save" for other formats)
2. You can plot several variables with
plot (t, ca, 'r-', t, out, 'b-')
Strings 'r-' and 'b-' set color (red and blue) and linestyle (solid line).
3. @ is used to create anonymous function - see chapter 11 ("Functions
and script files") of Octave manual
Regards
Ivan Sutoris