octave

Octave basic

Tag(s):

Variables

octave-3.2.4.exe:5> x=2;
octave-3.2.4.exe:6> y=3;
octave-3.2.4.exe:7> x*y
ans =  6


Vectors

octave-3.2.4.exe:15> v=[1 2 3]
v =
 
   1   2   3
 
octave-3.2.4.exe:16> v*2
ans =
 
   2   4   6


Multiple functions on 1 graph

Tag(s):

octave-3.2.4.exe:1> function y = a(x)
> y=3*x;
> endfunction
octave-3.2.4.exe:2> function y = b(x)
> y=5*x;
> endfunction
octave-3.2.4.exe:3> a(3)
ans =  9
octave-3.2.4.exe:4> b(3)
ans =  15
octave-3.2.4.exe:5> x=1:1:15;
octave-3.2.4.exe:6> plot( x, a(x), b(x) )
octave-3.2.4.exe:7>
octave-3.2.4.exe:7> title("Multiple functions on 1 graph")
octave-3.2.4.exe:8> xlabel("x")
octave-3.2.4.exe:9> ylabel("y")
Subscribe to RSS - octave