Editing Octave Basics
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 11: | Line 11: | ||
=== Vectors and matrices === | === Vectors and matrices === | ||
: | .* | ./ | .^ | ' | .' | \ | length | numel | size | zeros | ones | eye | diag | rand | det | trace | inv | lu | eig | cond | expm | |||
x = 1:5, x(:), x(2:4), A = [11 12; 21, 22], A(1,1:end) ↵ | |||
x = 1:5, x(:), x(2:4), A = [11 12; 21, 22], A(1,1:end) | |||
=== Graphics === | === Graphics === | ||
<tt>plot | semilogx | semilogy | loglog | contour | quiver | surf | mesh | meshgrid | xlabel | ylabel | zlabel | title | grid | axis | hold | subplot | figure | print</tt> | |||
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) ↵ | |||
< | |||
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) | |||
=== Scripts and functions === | === Scripts and functions === | ||
< | <tt>@ | function | return | nargin | nargout | varargin | varargout | feval | eval</tt> | ||
f = @(x) x.^2, f(1:10) ↵ | |||
< | |||
f = @(x) x.^2, f(1:10) | |||
function v = cossum (x, n) v = cumsum (repmat (cos (x), 1, n)); | function v = cossum (x, n) v = cumsum (repmat (cos (x), 1, n)); | ||
=== Programming elements === | === Programming elements === | ||
< | <tt>== | > | < | >= | <= | != | | || | | & | && | ! | if | else | elseif | for | while |end | break | continue | pause</tt> | ||
for i = 1:5 if (i < 3) disp (i) else disp (i^2) end end ↵ | |||
for i = 1:5 if (i < 3) disp (i) else disp (i^2) | |||
== See also == | == See also == |