University of California at Berkeley Department of Electrical Engineering & Computer Sciences Instructional & Electronics Support Groups /share/b/pub/matlab.help /share/b/pub/sedumi.help /share/b/pub/mosek.help /share/b/pub/cvx.help Jan 19 2018 MATLAB on the Instructional Systems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONTENTS: MATLAB Availability, Licensing MATLAB on Instructional Computers MATLAB on UNIX MATLAB on Windows MATLAB for CS9A students Versions of MATLAB Printing graphics from MATLAB MATLAB Manuals Purchasing MATLAB Free Alternatives to MATLAB SeDuMi Optimization ToolKit (obsolete) MOSEK Optimization ToolKit (obsolete) SUGAR Simulation Tool for MEMS (obsolete) CVX Convex Optimization ToolKit (obsolete) MATLAB Troubleshooting MATLAB Availability, Licensing ------------------------------- MATLAB (http://www.mathworks.com) from Mathworks Inc, Sherborn, MA, can be used to model and analyze dynamic systems, including linear, nonlinear, continuous, discrete, and hyprid types. Students can get it from the campus and install it on their own systems, and they can run it on EECS computers using the instructional accounts that they can get from http://inst.eecs.berkeley.edu/webacct. Matlab is licensed by the campus for all employees and students. They can install it on their own computers. Licenses and toolboxes are available from https://software.berkeley.edu/matlab. In addition, Matlab is available on all of the EECS instructional labs and server computers. See "MATLAB on Instructional Computers" below. For a list of toolkits that are licensed for all users on campus via the campus networked license server, login here with your Calnet ID: https://inst.eecs.berkeley.edu/~inst/matlab/ Funding is provided by 8 Colleges and Organizations who are the majority users. With this new agreement, students and employess are eligible to use Matlab on their personally-owned devices to meet classroom requirements for courses and study offered by UCB. MATLAB on Instructional Computers --------------------------------- To run it on the EECS Instructional computers, you need an Instructional account. See http://inst.eecs.berkeley.edu/connecting.html#accounts. The EECS Instructional computers can be listed via http://inst.eecs.berkeley.edu/connecting.html#labs. Some options: Linux: * use PCs in 277 Soda, or a login server such as "cedar.cs" * start Matlab in a Terminal with '/share/b/bin/matlab'. Windows: * use PCs in 199 Cory, or a terminal server such as "wserver1.eecs" * start 'Matlab' from the Start menu. See "MATLAB on UNIX" and "MATLAB on Windows" below for usage details. There are Matlab commands that test the licenses for some toolboxes: >> license # displays this license number >> license('inuse') # lists licenses used in this session >> struct=license('inuse') # table of licenses and users >> license('test', 'Simulink') # 1=license exists; 0=no license >> license('checkout', 'Simulink') # 1=license OK; 0=no license >> version # version info >> ver('matlab') # version info >> plot (0,0); # opens blank 'Figure 1' graph >> mbuild -setup # set up a default C/C++ compiler >> sys=tf(1,2); # uses Control Toolbox >> bode(sys); # uses Control Toolbox >> solve('p*sin(x) = r') # uses Symbolic Math Toolbox >> solve('x^2 = 9') # uses Symbolic Math Toolbox >> x = sym([2.5; -9.639]) # uses Symbolic Math Toolbox >> nnstart # uses Neural Network Toolbox >> instrhwinfo # uses Instrument Control Toolbox >> visionlib # uses Computer Vision System Toolbox >> iptgetpref # uses Image Processing Toolkit MATLAB on UNIX -------------- You can login at a Linux workstation or use 'ssh' to login to a Linux server and run Matlab there. To run it from a Linux server, you'll need an XWindows graphics program such as XMing or X2go on your local computer (see http://inst.eecs.berkeley.edu/connecting.html#xwindows) or you can run Matlab in the text-only mode ("matlab -nodisplay") in your ssh terminal window. To run Matlab on the Instructional UNIX computers, type either /share/b/bin/matlab # requires XWindows for graphics /share/b/bin/matlab -nodisplay # for text-only version /share/b/bin/matlab -h # for all options /share/instsww/pkg/matlab-*/bin/mex # builds MEX-file from C or Fortran /share/b/bin/matlab runs the most current version that is installed. Type 'ls -d /share/instsww/pkg/' to see other versions that are installed. There is extensive online help built into the `matlab` program. MATLAB no longer has mbuild. It was a script that existed only in 5.2. (Oct 2010) MathWorks ended support for Solaris SPARC, so version 2009B was the last version that will be available on those systems. (Matlab was never available for Solaris X86). MATLAB on Windows ----------------- You can login to a Windows workstation or use Remote Desktop to login to a Windows server. To login from a UNIX or MacOSX computer, use 'rdesktop' on that computer. From another Windows computer, use 'mstsc.exe' the free Windows Remote Desktop Connection client program. To run Matlab on the Instructional Windows computers, select MATLAB from the Start/Programs Menu or desktop icon. MATLAB for CS9A students ------------------------ CS9A students need the Matlab Symbolic Toolbox ("solve", "syms"), which runs on our Linux systems. You can run Matlab on the 2 Linux PCs in the SelfPaced Center in 200A Sutarja Dai Hall (asterix.cs.berkeley.edu, obelix.cs.berkeley.edu). On the command line, type '/share/b/bin/matlab'. You can login to those systems remotely using ssh or Putty/Xming (see http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=ssh.help) Versions of MATLAB ------------------ These commands were changed in v 4.1 (compared with v 3.5f): ACCESS CLG CONTOUR HOLD MESH You may need to modify these the use of these commands to port old code to the new version. For details, please use the "help" command within matlab. Printing graphics from MATLAB ----------------------------- MATLAB includes a "gpp" UNIX command and its own internal "print" command for creating hard-copy printouts of graphics. With "print", use the "-P" option to name the printer you want. For example, to print the contents of the current graphics window to a monochrome Postscript printer called "lw119", type: >> print -dps -Plw119 Some MATLAB on-line help information fails to mention the "-P" option. MATLAB Manuals -------------- There are instructional videos and interactive tutorials at http://www.mathworks.com/academia/tah-support-program/ To access the online documentation (Help) within MATLAB, select Full Product Family Help from the Help menu in the MATLAB Command Window. You can also type helpbrowser at the MATLAB prompt. The MATLAB Primer by Kermit Sigmon of the University of Florida is available at http://math.ucsd.edu/~driver/21d-s99/matlab-primer.html Free Alternatives to MATLAB --------------------------- There are two "almost matlab" interpreters available: - GNU Octave: http://www.octave.org - Freemat: http://freemat.sourceforge.net SeDuMi Optimization ToolKit (obsolete) --------------------------- SeDuMi was formerly installed for our Solaris (UNIX) systems. We no longer have the Solaris systems. So, the following old notes are here as a reference: EECS Instruction has obtained the SeDuMi optimization toolbox for UNIX. See http://inst.eecs.berkeley.edu/clients for the names and locations of the computers. You can determine which kind of UNIX computer you are on with the command 'uname -a'. SeDuMi is installed in /share/b/sedumi. The binaries are in subdirectories called "axp" for the Alpha binaries "pa" for the hpux binaries "sol2" for the solaris binaries You can run SeDuMi modules by starting Matlab and tben typing one of these, depending on which addpath /share/b/sedumi/axp addpath /share/b/sedumi/pa addpath /share/b/sedumi/sol2 You can also modify your Matlab startup.m file to include the appropriate SeDuMi files (a line that starts with % is a comment): % add SeDuMi to the Matlab search path addpath(['/share/b/sedumi:']); addpath(['/share/b/sedumi/conversion:']); addpath(['/share/b/sedumi/sol2:']); addpath(['/share/b/sedumi/pa:']); addpath(['/share/b/sedumi/axp:']); Then type a command such as "sedumi 1 2 3" at the Matlab command line. Documentation: /share/b/sedumi/doc SeDuMi is free from http://sedumi.ie.lehigh.edu/ MOSEK Optimization ToolKit (obsolete) -------------------------- MOSEK was formerly installed for our Solaris (UNIX) systems. We no longer have the Solaris systems. So, the following old notes are here as a reference: The MOSEK optimization toolbox was installed in /share/b/mosek for UNIX and C:\Program Files\Mosek on some Windows login servers. The licenses have expired, and we do not have a current version. Prof El Ghaoui obtained the licenses for EE227A in October 2010. The licenses ran under FlexLM on license-srv.eecs. You can add this to your Matlab path in 3 ways: 1) Before you start Matlab, add this to your Matlab startup.m file: addpath(['/share/b/mosek/toolbox/solvers:']); addpath(['/share/b/mosek/toolbox/examp:']); 2) After you start Matlab, type this in the command line: addpath /share/b/mosek/toolbox/solvers addpath /share/b/mosek/toolbox/examp 3) After you start Matlab, select "File/Add Path..." and enter /share/b/mosek/toolbox/solvers /share/b/mosek/toolbox/examp To run MOSEK on UNIX, type /share/b/bin/matlab (we will set the MOSEKLM_LICENSE_FILE variable there) and type a MOSEK command such as "go1" at the Matlab prompt. Documentation: /share/b/mosek/tools/doc /share/b/mosek/tools/help /share/b/mosek/tools/examp MOSEK is licensed software from EKA Consulting ApS Fruebjergvej 3, Boks 16 2100 Copenhagen, Denmark Phone: +45 3917 9907 Fax: +45 3927 5521 Email: sales@mosek.com VAT number: 20437537 http://www.mosek.com For an open-source alternative to Mosek, please see http://www.stanford.edu/~boyd/cvx/ SUGAR Simulation Tool for MEMS (obsolete) ------------------------------ SUGAR was formerly installed for our Solaris (UNIX) systems. We no longer have the Solaris systems. So, the following old notes are here as a reference: SUGAR is an open source simulation tool for micro-electromechanical systems (MEMS). It is developed by the BSAC research group at UCB (http://www-bsac.eecs.berkeley.edu/programs/sugar.html). It is now available from http://sourceforge.net/projects/mems/ We have installed SUGAR on the Instrcuctional UNIX SPARC computers. See http://inst.eecs.berkeley.edu/~inst/iesglabs.html for hostnames. To load the SUGAR functions in Matlab, start 'matlab' and type: addpath /share/instsww/matlab/sugar/ sugar_init You can also add the path to your Matlab startup.m file or, before starting 'matlab' on UNIX you can type setenv MATLABPATH /share/instsww/matlab/sugar/ CVX Convex Optimization ToolKit (obsolete) ------------------------------- CVX was formerly installed for our Solaris (UNIX) systems. We no longer have the Solaris systems. So, the following old notes are here as a reference: CVX is a Matlab-based modeling system for convex optimization from http://www.stanford.edu/~boyd/cvx/. We have installed CVX on the Instructional UNIX SPARC computers. For hostnames, please see http://inst.eecs.berkeley.edu/~inst/iesglabs.html. To load the CVX functions in Matlab, start 'matlab' and type: addpath /share/instsww/matlab/cvx/builtins addpath /share/instsww/matlab/cvx/commands addpath /share/instsww/matlab/cvx/functions addpath /share/instsww/matlab/cvx/lib addpath /share/instsww/matlab/cvx/structures addpath /share/instsww/matlab/cvx cvx_version Sample use of CVX: m = 16; n = 8; A = randn(m,n); b = randn(m,1); cvx_begin; variable x(n); minimize( norm(A*x-b) ); cvx_end For help, type "help cvx" in Matlab or type "acroread /share/instsww/matlab/cvx/cvx_usrguide.pdf" on the UNIX command line. You can also add the path to your Matlab startup.m file. The startup.m file is usually in your ~/.matlab directory. There is also a version of CVX for python at http://cvxmod.net/ (see /share/b/pub/python.help). MATLAB Troubleshooting ---------------------- Problem: "when i typed "plot(0,0)", the system complains "no cla.m found". Solution: Delete ~/.matlab/R2011a/toolbox_cache*, restart Matlab (which recreates toolbox_cache). Or, run the Matlab command "rehash toolbox". EECS Instructional Support Group 386 Cory, 333 Soda (inst@eecs.berkeley.edu)