23
edits
(All output codes are of lang="text") |
No edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
First, follow the [https://www.gnu.org/software/octave/doc/interpreter/Installation.html | First, follow the installation instructions for: | ||
to install GNU Octave on your system. | * [[Octave for macOS|macOS]] | ||
typing <code>octave</code> in a terminal | * [[Octave for GNU/Linux|GNU/Linux]] and [[Octave for other Unix systems|other Unix systems]] | ||
* [[Octave_for_Microsoft_Windows|Microsoft Windows]] | |||
[https://www.gnu.org/software/octave/doc/interpreter/Running-Octave.html | or consult the [https://www.gnu.org/software/octave/doc/interpreter/Installation.html GNU Octave manual] to install GNU Octave on your system. | ||
Then, start the GNU Octave by clicking the icon in the programs menu or launch the interactive prompt by typing <code>octave</code> in a terminal. | |||
See the manual page on [https://www.gnu.org/software/octave/doc/interpreter/Running-Octave.html running Octave]. | |||
[[File:GNU Octave screenshot.png|thumb|center|500px|The GNU Octave graphical user interface (GUI).]] | |||
= Variable Assignment = | = Variable Assignment = | ||
Line 112: | Line 114: | ||
= Control flow | = Control flow with 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 126: | Line 128: | ||
k = 1; | k = 1; | ||
step = 2; | step = 2; | ||
while (k <= | while (k <= 100) | ||
y( | y(k) = k^2; | ||
k = k + step; | k = k + step; | ||
endwhile</syntaxhighlight> | endwhile</syntaxhighlight> | ||
= Vectorization = | = Vectorization = | ||
Line 156: | Line 156: | ||
[https://www.gnu.org/software/octave/doc/interpreter/Two_002dDimensional-Plots.html about plotting]. | [https://www.gnu.org/software/octave/doc/interpreter/Two_002dDimensional-Plots.html about plotting]. | ||
<syntaxhighlight lang="octave">plot (i/10, w); | <syntaxhighlight lang="octave">plot (i / 10, w); | ||
title ('w = sin(i/10)'); | title ('w = sin (i / 10)'); | ||
xlabel ('i | xlabel ('i / 10'); | ||
ylabel ('w');</syntaxhighlight> | ylabel ('w');</syntaxhighlight> | ||
[[File:Using octave-1.png|thumb|center]] | |||
= Strings = | = Strings = | ||
Line 255: | Line 253: | ||
[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]. | ||
= Octave User Codes = | |||
There are also User Codes available for GNU Octave which are not part of the core program or any of the packages. | |||
[[:Category:User Codes|See Category User Codes]]. | |||
[[Category:Tutorials]] | [[Category:Tutorials]] |