1,852
edits
(→Graphics: Overhaul.) |
(Improve syntaxhighlight.) |
||
Line 13: | Line 13: | ||
<code>:</code> , <code>.*</code> , <code>./</code> , <code>.^</code> , <code>'</code> , <code>.'</code> , <code>\</code> , {{manual|length}} , {{manual|numel}} , {{manual|size}} , {{manual|zeros}} , {{manual|ones}} , {{manual|eye}} , {{manual|diag}} , {{manual|rand}} , {{manual|det}} , {{manual|trace}} , {{manual|inv}} , {{manual|lu}} , {{manual|eig}} , {{manual|cond}} , {{manual|expm}} | <code>:</code> , <code>.*</code> , <code>./</code> , <code>.^</code> , <code>'</code> , <code>.'</code> , <code>\</code> , {{manual|length}} , {{manual|numel}} , {{manual|size}} , {{manual|zeros}} , {{manual|ones}} , {{manual|eye}} , {{manual|diag}} , {{manual|rand}} , {{manual|det}} , {{manual|trace}} , {{manual|inv}} , {{manual|lu}} , {{manual|eig}} , {{manual|cond}} , {{manual|expm}} | ||
<syntaxhighlight lang="octave"> | |||
x = 1:5, x(:), x(2:4), A = [11 12; 21, 22], A(1,1:end) | |||
</syntaxhighlight> | |||
=== Graphics === | === Graphics === | ||
Line 19: | Line 21: | ||
{{manual|plot}} , {{manual|semilogx}} , {{manual|semilogy}} , {{manual|loglog}} , {{manual|contour}} , {{manual|quiver}} , {{manual|surf}} , {{manual|mesh}} , {{manual|meshgrid}} , {{manual|xlabel}} , {{manual|ylabel}} , {{manual|zlabel}} , {{manual|title}} , {{manual|grid}} , {{manual|axis}} , {{manual|hold}} , {{manual|subplot}} , {{manual|figure}} , {{manual|print}} | {{manual|plot}} , {{manual|semilogx}} , {{manual|semilogy}} , {{manual|loglog}} , {{manual|contour}} , {{manual|quiver}} , {{manual|surf}} , {{manual|mesh}} , {{manual|meshgrid}} , {{manual|xlabel}} , {{manual|ylabel}} , {{manual|zlabel}} , {{manual|title}} , {{manual|grid}} , {{manual|axis}} , {{manual|hold}} , {{manual|subplot}} , {{manual|figure}} , {{manual|print}} | ||
<syntaxhighlight lang="octave"> | |||
t = 0:0.01*pi:21*pi; x = sin (t).*(exp (cos (t)) - 2*cos (4*t) + sin (t/12).^5); y = cos (t).*(exp (cos (t)) - 2*cos (4*t) + sin (t/12).^5); plot(x, y) | |||
</syntaxhighlight> | |||
=== Scripts and functions === | === Scripts and functions === | ||
<tt>@ | function | return | nargin | nargout | varargin | varargout | feval | eval</tt> | <tt>@ | function | return | nargin | nargout | varargin | varargout | feval | eval</tt> | ||
<syntaxhighlight lang="octave"> | |||
f = @(x) x.^2, f(1:10) | |||
function v = cossum (x, n) v = cumsum (repmat (cos (x), 1, n)); | |||
</syntaxhighlight> | |||
=== Programming elements === | === Programming elements === | ||
<tt>== | > | < | >= | <= | != | | || | | & | && | ! | if | else | elseif | for | while |end | break | continue | pause</tt> | <tt>== | > | < | >= | <= | != | | || | | & | && | ! | if | else | elseif | for | while |end | break | continue | pause</tt> | ||
<syntaxhighlight lang="octave"> | |||
for i = 1:5 if (i < 3) disp (i) else disp (i^2) endif endfor | |||
</syntaxhighlight> | |||
== See also == | == See also == |