Sunday, March 6, 2011

Introduction to Octave

1. help -i svd
2. Type q to exti help mode
3. Numerical Precision, variables are stored as double precision numbers in IEEE floating pointing format
    realmin : Smallest positive floating point number 2.23e-308
    realmax : Largest positive floating point number 1.80e-308
    eps : Relative precision 2.22e-16
4. rows(A) : Get number of rows of A
     columns(A) : Get number of columns of A
5. Exporting figures
    print -deps myPicBW.eps ---------------Export B/W .eps file
    print -depsc myPic.eps    ----------------Export color .eps file
    print -djpeg -r80 myPic.jpg --------------Export .jpg in 80 ppi
    print -dpng -r100 myPic.png -----------Export .png in 100ppi
See help print for more devices including specialized ones for latex.
print can also be called as a function
6. After a complex of lengthy computation, it is recommended to save variabls on the disk
   save my_vars.mat
7. For Unix/Linux/MacOSX systems, there is the command unix to execute system commands and return
    the result.
    Examples:
    unix('ls -al')
    unix('ftp < ftp_script')
    unix ('./myprogram')
8.   Hack the speed issue
a. For-loops are evil
b. Vectorization is good
c. Preallocation is good   
d. Prefer struct of arrays over arrays of struct

No comments:

Post a Comment