Editing Using Octave

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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 the installation instructions for:
First, follow the [https://www.gnu.org/software/octave/doc/interpreter/Installation.html installation guide]
* [[Octave for macOS|macOS]]
to install GNU Octave on your system. Then, launch the interactive prompt by
* [[Octave for GNU/Linux|GNU/Linux]] and [[Octave for other Unix systems|other Unix systems]]
typing <code>octave</code> in a terminal or by clicking the icon in the programs menu.
* [[Octave_for_Microsoft_Windows|Microsoft Windows]]
For further guidance, see the manual page on
or consult the [https://www.gnu.org/software/octave/doc/interpreter/Installation.html GNU Octave manual] to install GNU Octave on your system.
[https://www.gnu.org/software/octave/doc/interpreter/Running-Octave.html Running Octave].
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 114: Line 112:




= Control flow with loops =
= 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(k) = k^2;
   y(i) = 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 / 10');
xlabel ('i ÷ 10');
ylabel ('w');</syntaxhighlight>
ylabel ('w');</syntaxhighlight>


[[File:Using octave-1.png|thumb|center]]
<img src="octave_basics-1.png" alt="octave_basics-1.png">
 
 


= Strings =
= Strings =
Line 252: Line 254:


[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]]
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)