Using Octave: Difference between revisions
Jump to navigation
Jump to search
→Control flow with loops
(→Plotting: Add missing image.) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 112: | Line 112: | ||
= 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 126: | ||
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 161: | Line 159: | ||
ylabel ('w');</syntaxhighlight> | ylabel ('w');</syntaxhighlight> | ||
[[File:Using octave-1.png]] | [[File:Using octave-1.png|thumb|center]] | ||
= Strings = | = Strings = |