Editing Using Octave
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
First, follow | First, follow the [https://www.gnu.org/software/octave/doc/interpreter/Installation.html installation guide] | ||
to install GNU Octave on your system. Then, launch the interactive prompt by | |||
typing <code>octave</code> in a terminal or by clicking the icon in the programs menu. | |||
For further guidance, see the manual page on | |||
[https://www.gnu.org/software/octave/doc/interpreter/Running-Octave.html Running Octave]. | |||
Then, | |||
= Variable Assignment = | = Variable Assignment = | ||
Line 114: | Line 112: | ||
= Control flow | = Control flow wih loops = | ||
Octave supports <code>for</code> and <code>while</code> loops, as well as other control flow | Octave supports <code>for</code> and <code>while</code> loops, as well as other control flow | ||
Line 128: | Line 126: | ||
k = 1; | k = 1; | ||
step = 2; | step = 2; | ||
while (k <= 100) | while (k <= (100-step)) | ||
y( | y(i) = k^2; | ||
k = k + step; | k = k + step; | ||
endwhile</syntaxhighlight> | endwhile</syntaxhighlight> | ||
= Vectorization = | = Vectorization = | ||
Line 161: | Line 161: | ||
ylabel ('w');</syntaxhighlight> | ylabel ('w');</syntaxhighlight> | ||
[[File:Using octave-1.png | [[File:Using octave-1.png]] | ||
= Strings = | = Strings = | ||
Line 239: | Line 239: | ||
= Octave packages = | = Octave forge packages = | ||
Community-developed packages can be added from the | Community-developed packages can be added from the | ||
[ | [http://octave.sourceforge.net/index.html Octave Forge] website to extend | ||
the functionality of Octave’s core library. (Matlab users: | the functionality of Octave’s core library. (Matlab users: Forge packages | ||
act similarly to Matlab’s toolboxes.) The [https://www.gnu.org/software/octave/doc/interpreter/XREFpkg.html pkg] command is used | act similarly to Matlab’s toolboxes.) The [https://www.gnu.org/software/octave/doc/interpreter/XREFpkg.html pkg] command is used | ||
to manage these packages. For example, to use the image processing library | to manage these packages. For example, to use the image processing library | ||
from the Forge, use: | |||
<syntaxhighlight lang="octave">pkg install | <syntaxhighlight lang="octave">pkg install -forge image # install package | ||
pkg load image # load new functions into workspace | pkg load image # load new functions into workspace | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[https://www.gnu.org/software/octave/doc/interpreter/Packages.html Read more about packages]. | [https://www.gnu.org/software/octave/doc/interpreter/Packages.html Read more about packages]. | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |