Skip to content

Latest commit

 

History

History
93 lines (72 loc) · 1.38 KB

octave.md

File metadata and controls

93 lines (72 loc) · 1.38 KB

Octave

Menu: Home | bash | Compilers | Elixir | F# | Go | Haskell | OCaml | Octave | Perl | Python | R | Rust | Scala | SQL

Inbox

Misc Commands

% Comments begin with percent sign: %
PS1('>> ') % Change prompt
pwd % Current directory
cd '/tmp' % Change working directory; Will load .m functions from here
help help
help plot
  • Language Introduction

** If statement

** For loop

** Simple Function

% No parameters
% Invoke: hello() or hello
%
function hello()
  printf("Hello\n");

end

% Two parameters
% Invoke: mymax(1,2)
%
function mysum(x,y)
  a = x + y
  printf("Sum:%d\n", a);
end

% Two parameters
% Invoke: mysum(1,2)
%
function a = mysum(x,y)
  a = x + y

end

** Load and Save Data

** Plot statement

** Matrices

A = [1 2; 3 4; 5 6];
B = [1 2 3; 4 5 6];
zeros(1,3) % [0 0 0 0]

A = |1| 2| |3|4| |5|6|

A = [1 2; 3 4; 5 6];

B= |1|2|3 |4|5|6

B = [1 2 3; 4 5 6];

*** Identity Matrix

eye(4) % 4x4 identity matrix