ࡱ> 5@  bjbj22 "NXX vvvvvvv""""|2v  $|$Rj&v &vv ;v v vv &<" Q0ooD vvvvov(`*t.```&&~ ~Table of Contents:  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.#1." 1. General Questions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.#1.1." 1.1. General Information  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.1.#1.1.1." 1.1.1. What is MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.2.#1.1.2." 1.1.2. What is SIMULINK?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.3.#1.1.3." 1.1.3. On what machines is MATLAB available?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.4.#1.1.4." 1.1.4. What was first: the company MathWorks or the product MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.5.#1.1.5." 1.1.5. What is the history of MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.6.#1.1.6." 1.1.6. What is the charter for the USENET Newsgroup comp.soft-sys.matlab?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.7.#1.1.7." 1.1.7. Are there any software archives?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.8.#1.1.8." 1.1.8. Are there any publications related to MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.9.#1.1.9." 1.1.9. What toolboxes are currently available from The MathWorks?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.1.10.#1.1.10." 1.1.10. How do I contact The MathWorks about MATLAB via email?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.#1.2." 1.2. Product Information  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.1.#1.2.1." 1.2.1. What's new in MATLAB 4.2?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.2.#1.2.2." 1.2.2. When will MATLAB 4.2 be released on the various platforms?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.3.#1.2.3." 1.2.3. How does MATLAB perform on machine X?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.4.#1.2.4." 1.2.4. What's new with SIMULINK?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.5.#1.2.5." 1.2.5. What's new in Signal Processing Toolbox version 3.0?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.6.#1.2.6." 1.2.6. What's new in Neural Network Toolbox version 2.0?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.7.#1.2.7." 1.2.7. Can a C or FORTRAN subroutine be called directly from MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.8.#1.2.8." 1.2.8. Can I call MATLAB routines from my C or FORTRAN programs?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.9.#1.2.9." 1.2.9. Is there going to be a 4.0 version of the Student Edition?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.2.10.#1.2.10." 1.2.10. Is there a MATLAB compiler?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.#1.3." 1.3. User Questions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.#1.3.1." 1.3.1. General MATLAB Questions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.1.#1.3.1.1." 1.3.1.1. How do I import graphics into other applications?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.2.#1.3.1.2." 1.3.1.2. How do I run MATLAB in the background under UNIX? MS Windows?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.3.#1.3.1.3." 1.3.1.3. Why doesn't MATLAB run as fast as I expect it to?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.4.#1.3.1.4." 1.3.1.4. How can I change the default window size, colors, etc., in MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.5.#1.3.1.5." 1.3.1.5. How do I manipulate colormaps?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.6.#1.3.1.6." 1.3.1.6. Is there a topical help function, like 'apropos'?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.7.#1.3.1.7." 1.3.1.7. How can I get information about undocumented functions (like comet) in MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.8.#1.3.1.8." 1.3.1.8. How does the Random generator work?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.9.#1.3.1.9." 1.3.1.9. Is there a Pseudo-Random Binary Sequence (PRBS) generator in MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.10.#1.3.1.10." 1.3.1.10. What is the numeric precision of MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.1.11.#1.3.1.11." 1.3.1.11. How do I run MATLAB in batch mode?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.2.#1.3.2." 1.3.2. Matrices  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.2.1.#1.3.2.1." 1.3.2.1. What is the largest matrix MATLAB can handle?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.2.2.#1.3.2.2." 1.3.2.2. How does MATLAB index its matrices?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.2.3.#1.3.2.3." 1.3.2.3. Can MATLAB handle multidimensional arrays?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.2.4.#1.3.2.4." 1.3.2.4. How can I initialize a low rank matrix easily?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.3.#1.3.3." 1.3.3. Functions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.3.1.#1.3.3.1." 1.3.3.1. Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.3.2.#1.3.3.2." 1.3.3.2. How can I get the parser to accept a dummy reference without an error?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.3.3.#1.3.3.3." 1.3.3.3. Is there a GNU emacs editing mode for MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.3.4.#1.3.3.4." 1.3.3.4. Does MATLAB have a debugger?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.4.#1.3.4." 1.3.4. eval Command  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.4.1.#1.3.4.1." 1.3.4.1. How does the eval command work?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.4.2.#1.3.4.2." 1.3.4.2. How can I use a filename that is a variable as an input argument to the load, save, and print functions?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.5.#1.3.5." 1.3.5. MATLAB Functions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.5.1.#1.3.5.1." 1.3.5.1. Why was fsolve removed from MATLAB Version 4?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.5.2.#1.3.5.2." 1.3.5.2. What is griddata? How do I use it to contour irregularly spaced data?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.5.3.#1.3.5.3." 1.3.5.3. What is the sign convention used in MATLAB's fft routines?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.5.4.#1.3.5.4." 1.3.5.4. How do I fit a curve in MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.6.#1.3.6." 1.3.6. File I/O  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.6.1.#1.3.6.1." 1.3.6.1. How do I use fread, fwrite, and fprintf?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.6.2.#1.3.6.2." 1.3.6.2. How can I store the result of ls *.dat in a variable?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.7.#1.3.7." 1.3.7. Differential Equations  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.7.1.#1.3.7.1." 1.3.7.1. Can MATLAB solve Ordinary Differential Equations (ODE)?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.7.2.#1.3.7.2." 1.3.7.2. How do I pass in extra parameters to ode and quad?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.7.3.#1.3.7.3." 1.3.7.3. How do I do double integration in MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.8.#1.3.8." 1.3.8. Memory  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.8.1.#1.3.8.1." 1.3.8.1. What can I do when MATLAB tells me I'm out of memory?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.9.#1.3.9." 1.3.9. Student Edition  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.9.1.#1.3.9.1." 1.3.9.1. Why does my Student Edition hang my machine after the MATLAB banner is displayed?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "1.3.9.2.#1.3.9.2." 1.3.9.2. How do I print using the Student Edition?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.#2." 2. Graphics  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.1.#2.1." 2.1. Using get and set  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.1.1.#2.1.1." 2.1.1. What is a handle?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.1.2.#2.1.2." 2.1.2. How do I use get and set?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.1.3.#2.1.3." 2.1.3. What properties can I control?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.1.4.#2.1.4." 2.1.4. How do I change the default settings for an object's properties?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.1.5.#2.1.5." 2.1.5. How do I change the default settings back to their original settings?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.#2.2." 2.2. Properties of the Figure and the Axes  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.1.#2.2.1." 2.2.1. Fonts  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.1.1.#2.2.1.1." 2.2.1.1. How do I change the font of text objects?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.1.2.#2.2.1.2." 2.2.1.2. How do I change the font of tick labels?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.1.3.#2.2.1.3." 2.2.1.3. How do I get Greek letters in my text objects?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.1.4.#2.2.1.4." 2.2.1.4. Can I have multiple fonts in one text object?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.2.#2.2.2." 2.2.2. Lines  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.2.1.#2.2.2.1." 2.2.2.1. How do I change the line width?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.2.2.#2.2.2.2." 2.2.2.2. How do I change the line style order on printouts?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.2.3.#2.2.2.3." 2.2.2.3. How do I cycle through the line color order?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.3.#2.2.3." 2.2.3. Positions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.3.1.#2.2.3.1." 2.2.3.1. How do I change the size and position of my figure window?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.3.2.#2.2.3.2." 2.2.3.2. How do I define an invisible axis?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.2.3.3.#2.2.3.3." 2.2.3.3. Which units should I use?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.3.#2.3." 2.3. Background Color  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.3.1.#2.3.1." 2.3.1. How do I invert the background on my printout?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.3.2.#2.3.2." 2.3.2. How do I change my background for plots?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.4.#2.4." 2.4. Using MATLAB Graphs with Other Packages  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.4.1.#2.4.1." 2.4.1. Can graphics be saved as files to be imported back into MATLAB for viewing and alteration?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.4.2.#2.4.2." 2.4.2. Can I edit MATLAB graphs in other applications?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.4.3.#2.4.3." 2.4.3. How do I copy and paste MATLAB graphs to the clipboard?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.5.#2.5." 2.5. Graphical User Interface (GUI)  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.5.1.#2.5.1." 2.5.1. How do I make a dialog box?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.5.2.#2.5.2." 2.5.2. How do CallBacks work? What is the best way to write a CallBack?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.5.3.#2.5.3." 2.5.3. Where do CallBacks get executed?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.6.#2.6." 2.6. Miscellaneous  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.6.1.#2.6.1." 2.6.1. Why does waterfall return a blank screen?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.6.2.#2.6.2." 2.6.2. How do you get perspective with 3-D plots?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.6.3.#2.6.3." 2.6.3. Why does MATLAB sometimes draw patches out of order?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.6.4.#2.6.4." 2.6.4. How do I use multiple colormaps?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "2.6.5.#2.6.5." 2.6.5. What is the difference between pcolor and image?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.#3." 3. Printing  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.1.#3.1." 3.1. General  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.1.1.#3.1.1." 3.1.1. How do I print in MATLAB?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.1.2.#3.1.2." 3.1.2. How do I print a SIMULINK block diagram?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.2.#3.2." 3.2. GhostScript  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.2.1.#3.2.1." 3.2.1. What is GhostScript? How do I use it?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.2.2.#3.2.2." 3.2.2. Where can I get documentation for GhostScript?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.2.3.#3.2.3." 3.2.3. Why would I print with a GhostScript device?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.2.4.#3.2.4." 3.2.4. What do I do if my printer isn't listed among the GhostScript devices?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.2.5.#3.2.5." 3.2.5. How do you use GhostScript to display PostScript files to the screen from DOS?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.3.#3.3." 3.3. Printing to a File  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.3.1.#3.3.1." 3.3.1. How do I print to a file?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.3.2.#3.3.2." 3.3.2. How do I know what option to use?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.3.3.#3.3.3." 3.3.3. How do I print out an HPGL format file?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.4.#3.4." 3.4. SIMULINK Printing  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.4.1.#3.4.1." 3.4.1. How do I change fonts in SIMULINK?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.4.2.#3.4.2." 3.4.2. What do I do if I am getting SIMULINK blocks and no text?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.4.3.#3.4.3." 3.4.3. How do I print my SIMULINK diagram on more than one page?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.4.4.#3.4.4." 3.4.4. How do I print a SIMULINK model from within an M-file?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.#3.5." 3.5. Common Problems  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.1.#3.5.1." 3.5.1. Why does my printer hang when I try to print from the pulldown menu?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.2.#3.5.2." 3.5.2. Why, after a long session of MATLAB under MS Windows where many figures printed, do I start to have a problem printing?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.3.#3.5.3." 3.5.3. Why don't my axis labels print correctly?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.4.#3.5.4." 3.5.4. Why can't I print broken lines?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.5.#3.5.5." 3.5.5. Why can't I print UI controls?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.6.#3.5.6." 3.5.6. Why, when I use interpolated shading or print surfaces, does my graph look "blocky" when the graph looked fine on the screen?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "3.5.7.#3.5.7." 3.5.7. What do I do if my PC beeps and hangs when I try to print?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.#4." 4. License Manager  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.1.#4.1." 4.1. Installing MATLAB  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.1.1.#4.1.1." 4.1.1. Are there step by step instructions for installation?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.1.2.#4.1.2." 4.1.2. When should I run lmdebug?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.1.3.#4.1.3." 4.1.3. When do I have to run the license manager?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.2.#4.2." 4.2. License Configurations  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.2.1.#4.2.1." 4.2.1. How do I set up the license manager so that it runs on a heterogeneous network?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.2.2.#4.2.2." 4.2.2. On a UNIX network, how do I run a back-up server configuration?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.2.3.#4.2.3." 4.2.3. How do I combine license.dat files if I am running another vendor that uses FlexLM?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.2.4.#4.2.4." 4.2.4. How do I run two versions of MATLAB on a VAX?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.#4.3." 4.3. Common Error Messages:  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.1.#4.3.1." 4.3.1. Cannot Connect to License Server  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.2.#4.3.2." 4.3.2. XXX Feature is not Currently Licensed  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.3.#4.3.3." 4.3.3. Environment Variable of lm_license_file Not Defined  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.4.#4.3.4." 4.3.4. No TCP License Server Exists  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.5.#4.3.5." 4.3.5. Invalid Returned Data From License Server  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.6.#4.3.6." 4.3.6. License Server Does Not Support This Feature  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "4.3.7.#4.3.7." 4.3.7. Unable to Read License File  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.#5." 5. SIMULINK/MEX-Files/Engine  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.#5.1." 5.1. SIMULINK  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.1.#5.1.1." 5.1.1. Printing SIMULINK models  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.1.1.#5.1.1.1." 5.1.1.1. How do I print my SIMULINK model?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.1.2.#5.1.1.2." 5.1.1.2. Why doesn't the text on my SIMULINK diagram print out?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.2.#5.1.2." 5.1.2. MATLAB Function block  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.2.1.#5.1.2.1." 5.1.2.1. Why can't I call any MATLAB function from the MATLAB Function block?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.2.2.#5.1.2.2." 5.1.2.2. What is the difference between the MATLAB Function block and the function block?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.3.#5.1.3." 5.1.3. General Questions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.3.1.#5.1.3.1." 5.1.3.1. How do I mask SIMULINK blocks?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.3.2.#5.1.3.2." 5.1.3.2. Why doesn't linmod return the correct results?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.3.3.#5.1.3.3." 5.1.3.3. Can SIMULINK handle complex signals?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.3.4.#5.1.3.4." 5.1.3.4. How do I use the set_param and get_param functions?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.4.#5.1.4." 5.1.4. S-functions  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.4.1.#5.1.4.1." 5.1.4.1. What is the flag ordering for S-functions?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.4.2.#5.1.4.2." 5.1.4.2. How do I display values numerically, rather than graphically (with the scope)?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.1.4.3.#5.1.4.3." 5.1.4.3. Are there any examples of S-functions in C? FORTRAN?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.#5.2." 5.2. MEX-Files and Engine  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.1.#5.2.1." 5.2.1. Compilers we support  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.2.#5.2.2." 5.2.2. MEX-File function examples  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.2.1.#5.2.2.1." 5.2.2.1. Where can I get C MEX-file function examples?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.2.2.#5.2.2.2." 5.2.2.2. Are there any FORTRAN MEX-file examples?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.2.3.#5.2.2.3." 5.2.2.3. How do I write a C++ MEX-file function?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.2.4.#5.2.2.4." 5.2.2.4. Are there any engine examples?  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.3.#5.2.3." 5.2.3. Common Problems  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "5.2.3.1.#5.2.3.1." 5.2.3.1. Why an I getting a segmentation violation error?  1. General Questions 1.1. General Information 1.1.1. What is MATLAB? MATLAB was originally developed to be a "matrix laboratory," written to provide easy access to matrix software developed by the LINPACK and EISPACK projects. Since then, the software has evolved into an interactive system and programming language for general scientific and technical computation and visualization. The basic MATLAB data element is a matrix. MATLAB commands are expressed n a form very similar to that used in mathematics and engineering. For instance, b = A x, where A, b, and x are matrices, is written b = A * x . To solve for x in terms of A and b, write x = A\b . There is no need to program matrix operations explicitly like multiplication or inversion. Solving problems in MATLAB is, therefore, generally much quicker than programming in a high-level language such as C or FORTRAN. There are hundreds of built-in functions that come with the basic MATLAB and there are optional "toolboxes" of functions for specific purposes such as Controls, Signal Processing, and Optimization. Most of the functions in MATLAB and the Toolboxes are written in the MATLAB language and the source code is readable. There are two basic versions of the software, the professional version, and the student edition. The student edition is distributed by Prentice-Hall, the professional version is distributed by The MathWorks, Inc. Send an email to info@mathworks.com or call 508-65-pi (508-653-1415) for more information. 1.1.2. What is SIMULINK? SIMULINK is an interactive system for the nonlinear simulation of dynamic systems. It is a graphical, mouse-driven program that allows systems to be modeled by drawing a block diagram on the screen. It can handle linear, nonlinear, continuous-time, discrete-time, multivariable, and multirate systems. SIMULINK runs on workstations using X-Windows, under Microsoft Windows on the PC, and on the Macintosh. It takes full advantage of windowing technology, including pull-down windows and mouse interactions. SIMULINK is fully integrated with MATLAB, and, together with MATLAB and the Control System Toolbox, forms a complete control system design and analysis environment. 1.1.3. On what machines is MATLAB available? MATLAB is available on machines ranging from the PC to the Cray. The list includes PC, Macintosh, and NEC personal computers, Sun, DEC, HP, IBM, and SGI workstations, VAX minicomputers, and Convex and Cray supercomputers. 1.1.4. What was first: the company MathWorks or the product MATLAB? MATLAB was first. The MathWorks, Inc. was founded in 1984 to develop and market MATLAB. 1.1.5. What is the history of MATLAB? In the mid-1970s, Cleve Moler and several colleagues developed the FORTRAN subroutine libraries called LINPACK and EISPACK under a grant from the National Science Foundation. LINPACK is a collection of FORTRAN subroutines for solving linear equations, while EISPACK contains subroutines for solving eigenvalue problems. Together, LINPACK and EISPACK represent the state of the art software for matrix computation. In the late 1970s, Cleve, who was then chairman of the computer science department at the University of New Mexico, wanted to be able to teach students in his linear algebra courses using the LINPACK and EISPACK software. However, he didn't want them to have to program in FORTRAN, because this wasn't the purpose of the course. So, as a "hobby" on his own time, he started to write a program that would provide simple interactive access to LINPACK and EISPACK. He named his program MATLAB, for MATrix LABoratory. Over the next several years, when Cleve would visit another university to give a talk, or as a visiting professor, he would end up by leaving a copy of his MATLAB on the university machines. Within a year or two, MATLAB started to catch on by word of mouth within the applied math community as a "cult" phenomena. In early 19 1.1.6. What is the charter for the USENET Newsgroup comp.soft-sys.matlab? The newsgroup comp.soft-sys.matlab is a forum for discussing issues related to the use of MATLAB, the scientific calculation and visualization package from The MathWorks Inc. Appropriate discussion in the group will include both general MATLAB issues and platform-specific questions, and discussions comparing MATLAB to other systems. 1.1.7. Are there any software archives? The MathWorks maintains an archive on the anonymous ftp server ftp.mathworks.com [144.212.100.10]. This site contains a "best of" copy of the NETLIB archive as well as other user-contributed, and MathWorks-contributed software and documentation. If you are interested in submitting software to the archive, get the file /README.incoming on the ftp site or send email to: drea@mathworks.com. 1.1.8. Are there any publications related to MATLAB? Yes, The MathWorks Inc. publishes a quarterly newsletter that gives information on products (new versions, releases, toolboxes), the MATLAB user group, MATLAB short courses, related texts etc. There is also a monthly email digest that contains annoncements, Q &A requests from users, news about our Internet services, etc. To subscribe to the newsletter, send email to subscribe@mathworks.com (Be sure to include your address adn your site identification/license number. To find out your site id, type "ver" at the MATLAB prompt.), or just type subscribe at your MATLAB prompt. 1.1.9. What toolboxes are currently available from The MathWorks? * Control System Toolbox. This is a toolbox for control system design and analysis. It supports transfer function and state-space forms (continuous/discrete time, frequency domain), as well as functions for step, impulse, and arbitrary input responses. Functions for Bode, Nyquist, Nichols plots, design with root-locus, pole-placement, and LQR optimal control are also included. * Image Processing Toolbox. The Image Processing Toolbox builds on MATLAB's numeric, signal processing, and visualization capabilities to provide a comprehensive system for image processing and algorithm development. * MMLE3 Identification Toolbox. The MMLE3 Identification Toolbox is a specialized toolbox for use with MATLAB and the Control System Toolbox for the estimation of continuous-time state-space models from observed input-output data. * Model Predictive Control Toolbox. The Model Predictive Control Toolbox is especially useful for applications involving constraints on the manipulated and/or controlled variables. For unconstrained problems, model predictive control is closely related to linear quadratic optimal control, but includes modeling and tuning options that simplify the design procedure. * Mu-Analysis and Synthesis Toolbox. The Mu-Analysis and Synthesis Toolbox contains specialized tools for the analysis and design of robust, linear control systems, extending MATLAB to provide additional application-specific capabilities. * Nonlinear Control Design. This toolbox provides a Graphical User Interface to assist in time-domain-based control design. With this toolbox, you can tune parameters within a nonlinear SIMULINK model to meet time-domain performance requirements. You can view the progress of an optimization while it is running. Optimization routines have been taken from the Optimization Toolbox. * Neural Network Toolbox. This is a toolbox for designing and simulating neural networks and supports implementation of the perceptron learning rule, the Widrow-Hoff rule, and several variations of the backpropagation rule. Transfer functions included are hard limit, linear, logistic, and hypertangent sigmoid. * Optimization Toolbox. This is a toolbox for linear and nonlinear optimization. It supports unconstrained and constrained minimization, minimax, nonlinear least squares, multi-objective, semi-infinite optimization, linear programming, quadratic programming, and the solution of nonlinear equations. * Robust Control Toolbox. This is a toolbox for robust control system design and supports LQG/loop transfer recovery, H2, H0, and mu- control synthesis, singular value frequency response, and model reduction. * Signal Processing Toolbox. This is a toolbox for digital signal processing (time series analysis). It includes functions for the design and analysis of digital filters, like Butterworth, Elliptic, and Parks-McClellan, and for FFT analysis (power spectrum estimation). It also includes some two-dimensional signal processing capabilities. * Spline Toolbox. This is a toolbox for working with splines and is typically used for curve fitting, solution of function equations, and functional approximation. * Statistics Toolbox. The Statistics Toolbox builds on the computational and graphics capabilities of MATLAB to provide: 1) statistical data analysis, modeling, and Monte Carlo simulation 2) building blocks for creating your own special-purpose statistical tools, and 3) GUI tools for exploring fundamental concepts in statistics and probability. * Symbolic Math Toolbox. The Symbolic Math Toolbox contains functions for symbolic algebra, exact linear algebra, variable precision arithmetic, equation solving, and special mathematical functions. Its underlying computational engine is the kernel of Maple. The Extended Symbolic Math Toolbox augments the functionality to include Maple programming features and specialized libraries. * System Identification Toolbox. This is a toolbox for parametric modeling. Identified models are in transfer function form (either z transform or Laplace transform) and state-space form (e.g., ARMA models or Box-Jenkins models). * Chemometrics Toolbox. This toolbox contains a library of functions that allows you to analyze data based on chemometrics methods including multiple linear regression, classical least squares, inverse least squares, Q-matrix, factor based methods, principle component regression, and partial least squares in latent variables. There are also useful functions for plotting data. * Frequency Domain System Identification Toolbox. This toolbox contains specialized tools for identifying linear dynamic systems from measurements of the system's excitation and response. Some of the identification procedures include excitation signal design, parameter estimation, graphical presentation of results, and model verification. * Hi-Spec  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "fn0#fn0" [tm] Toolbox. The Hi-Spec  HYPERLINK "http://www.engr.mun.ca/Local/matlab/matlabFAQ.html" \l "fn0#fn0" [tm ] Toolbox, a Partner Series Toolbox, was created by Jerry Mendel, C.L. (Max) Nikias, and Ananthram Swami. The Hi-Spec Toolbox is a collection of MATLAB routines whose primary features are functions for: * Higher-order spectrum estimation either by conventional or parametric approaches * Magnitude and phase retrieval * Adaptive linear prediction * Harmonic retrieval and quadratic phase coupling * Time-delay estimation and array signal processing Toolkits are also available from The Mathworks, Inc. Toolkits are colections of M-files associated with books. These are available from the publisher or from ftp.mathworks.com in /pub/books . * Control of Spacecraft and Aircraft Toolkit. This is a package of MATLAB programs to demonstrate the concepts discussed in the text "Control of Spacecraft and Aircraft," by Arthur E. Bryson. (1994) Princeton University Press, 1994. * Signal Processing Examples Toolkit. This is a package of MATLAB programs to demonstrate the concepts discussed in the text "Computer-Based Exercises for Signal Processing Using MATLAB," by C. Sidney Burrus, James H. McClellan, Alan V. Oppenheim, Thomas W. Parks, Ronald W. Schafe, and Hans Schuessler. (1994) Prentice Hall. * Delta Toolkit. This is a toolkit for analysis using the delta transform, an approach to unifying continuous and discrete systems theory without use of the z transform. It is available free to purchasers of "Digital Control and Estimation: A Unified Approach," by Graham Goodwin and Rick Middleton. * Numerical Methods for Physics Toolkit. This is a toolkit for which demonstrates the concepts discussed in the text "Numerical Methods for Physics Using MATLAB," by Alejandro Garcia. (1994) Prentice Hall. It is available free to purchasers of this text. * Numerical Methods for Mathematics, Science and Engineering Toolkit. This is a toolkit for which demonstrates the concepts discussed in the text "Numerical Methods for Mathematics, Science and Engineering, Second Edition," by John H. Matthews. (1994) Prentice Hall. It is available free to purchasers of this text. * Introduction to Linear Algebra Toolkit. This is a package of MATLAB programs to use with MATLAB in learning and experimenting with linear algebra. The toolbox is coordinated with the text: "Introduction to Linear Algebra," by Gilbert Strang. (1993) Wellesley-Cambridge Press Box 812060 Wellesley MA 02181. * Templates Toolkit . The M-files were created to supplement "Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods," by Richard Barrett, Michael Berry, Tony Chan, James Demmel, June Donato, Jack Dongarra, Victor Eijkhout, Roldan Pozo, Charles Romine, and Henk van der Vorst (SIAM, 1994). * Digitale Signalverarbeitung, Grundlagen und Anwendungen, Beispiele und Uebungen Toolkit. This is a toolkit for which demonstrates the concepts discussed in the text "Digitale Signalverarbeitung, Grundlagen und Anwendungen, Beispiele und Uebungen mit MATLAB," by Daniel Ch. von Grunigen. It is available free to purchasers of this text. 1.1.10. How do I contact The MathWorks about MATLAB via email? Here you go ... * support@mathworks.com Technical support * suggest@mathworks.com Product enhancement suggestions * bugs@mathworks.com Bug reports * doc@mathworks.com Documentation error reports * subscribe@mathworks.com Subscribing user registration * service@mathworks.com Order status, renewals, passcodes * info@mathworks.com Sales, pricing, general info. * digest@mathworks.com Submission and questions for the digest 1.2. Product Information 1.2.1. What's new in MATLAB 4.2? Here's a summary of the major additions and changes: * Ability to produce hpgl format files * Ability to import graphs into Adobe Illustrator '88 * Ability to save a figure and load it back into MATLAB * Better, faster graphics * DDE capability for the PC * Online documentation for UNIX systems * International Character Support (limited) * Many memory leak fixes 1.2.2. When will MATLAB 4.2 be released on the various platforms? The PC, SunOS, Solaris 2.2 and 2.3 and HP700 versions were released in late April 1994. Other UNIX platforms and the VMS version will follow shortly. In late May, the Mac version came out. The version for Power PC for the Mac will be released in late 1994. 1.2.3. How does MATLAB perform on machine X? One way to measure the speed of MATLAB is by looking at the LINPACK benchmarks: PC performance range: LINPACK (KFLOPS) VAXstation 3100 (VMS/D_floating) 365 HP 9000/400 (68030) 500 80486-based PC (33M Hz) 1300 HP 9000/425 (68040 chip) 1400 Macintosh Quadra 700 1500 Sun SPARCstation 1 1500 DECstation 3100 1600 SGI Indigo 2400 Sun SPARCstation 2 3600 Sun SPARCstation 10 9500 Convex C1 3700 IBM RS/6000 7000 HP 9000/700 7400 Cray X-MP 71000 Cray X-MP on a 500-by-500 matrix 135000 1.2.4. What's new with SIMULINK? SIMULINK has added the following features in version 1.3: * Vectorization of blocks * Scalar expansion of inputs * Automatic routing of block connections * Wide vector lines * Sample time coloration of model * Enhanced S-functions * Many bew blocks! 1.2.5. What's new in Signal Processing Toolbox version 3.0? The toolbox now offers enhanced filter design tools for digital and analog filters. Capabilities include the design of optimal least-square filters, minimum order estimation for FIR filters designed with remez , support for cascade filter implementation (second order sections decomposition), and analog Bessel filters. The toolbox has new functions to compute parametric models of signals and linear systems. In addition, there are now graphical demonstrations to provide easy exploration of filter parameters. 1.2.6. What's new in Neural Network Toolbox version 2.0? Some significant improvements include the addition of trainlm , the Levenberg-Marquardt training algorithm, radial basis functions for the efficient design of supervised feedforward networks, and the recurrent Elman network, which allows you to create networks that can both recognize and generate temporal patterns. 1.2.7. Can a C or FORTRAN subroutine be called directly from MATLAB? Yes, using "MEX-files." MATLAB's MEX-file facility allows any C or FORTRAN subroutine to be called directly from MATLAB. The MEX-file facility dynamically links your C or FORTRAN subroutine to the MATLAB program at run time. 1.2.8. Can I call MATLAB routines from my C or FORTRAN programs? Yes, there are two ways. The first is using "MEX-files." MATLAB's MEX-file facility allows any C or FORTRAN subroutine to be called directly from MATLAB. The MEX facility dynamically links your C or FORTRAN subroutine to the MATLAB program at runtime. From inside your C or FORTRAN subroutine, you can then call any MATLAB function. To call a MATLAB function from your program, you start MATLAB, then call your program. Your program is then in control and can access any MATLAB function. The second way to call MATLAB routines from your program is to use MATLAB as a computational engine. A set of subroutines is provided that allows you to start MATLAB, send data and commands to it, get data back, and terminate MATLAB. This way you can call any MATLAB routine from your FORTRAN or C function. 1.2.9. Is there going to be a 4.0 version of the Student Edition? A Student Edition of MATLAB 4.0 is currently in development. This new version will be released in the early Fall of 1994. 1.2.10. Is there a MATLAB compiler? A MATLAB compiler is currently in development. The release date is to be determined. 1.3. User Questions 1.3.1. General MATLAB Questions 1.3.1.1. How do I import graphics into other applications? The MATLAB (version 4) print command provides a -deps argument which provides an Encapsulated PostScript file of your plot. Some people have reported various problems getting this to work. Some suggestions: Removing the last line %%EOF from the eps-file. Use the pstoepsi filter from Doug Crabill ( dgc@cs.purdue.edu ). Use bbps and GhostScript. bbps.shar is available via anonymous ftp on csi.jpl.nasa.gov . You'll need to get GhostScript from your nearest GNU ftp site. Also, there is a technical note written on this topic available on our anonymous ftp server. It can be found in pub/tech-support/tech-notes/mat4.txt . 1.3.1.2. How do I run MATLAB in the background under UNIX? MS Windows? In UNIX: The nohup command and unsetting the display will allow you to run MATLAB in the background successfully even when you logout. Try the following: set OLDDISPLAY=$DISPLAY unsetenv DISPLAY nohup matlab < filein > fileout & setenv DISPLAY $OLDDISPLAY where filein is the M-file you want to run and fileout is the file you want the output to go to. To set this up as a C shell script, write a file called matbat as: #!/bin/csh set OLDDISPLAY=$DISPLAY unsetenv DISPLAY nohup matlab < $1 > $2 & setenv DISPLAY $OLDDISPLAY To run this file, issue the command as: matbat infile outfile In MS Windows: You need to set the ratio for applications running in the foreground as opposed to running in the background. This ratio will determine how well you can run MATLAB in the background. To set this ratio, go into 386 Enhanced in your Windows Control Panel. You can change your ratio here. 1.3.1.3. Why doesn't MATLAB run as fast as I expect it to? There are several things that can make MATLAB run slowly. FOR loops take a long time to run in MATLAB (relatively). You should avoid using them if at all possible, or have your for loops run in MEX-files. If you are using scripts rather than functions, then MATLAB loads your script into memory one line at a time, every time you call it. Functions are compiled into pseudo-code and are loaded into memory the first time they are called. Subsequent calls to the function are executed more quickly. Make sure that you don't have any other large applications running in the background and that there aren't a lot of other people logged onto your machine. These things can also cause MATLAB to run slowly. 1.3.1.4. How can I change the default window size, colors, etc., in MATLAB? From gray@SCR.slb.com ... If you're running MATLAB 4.x, something like the following should appear in your startup.m file: set(0,'DefaultFigurePosition',[5,5,505,405]) set(0,'DefaultFigureColor',[0,0,0]) %%N.B this has side %%effects. set(0,'DefaultAxesFontName','times') set(0,'DefaultTextFontName','times') set(0,'DefaultAxesFontSize',12) set(0,'DefaultTextFontSize',12) or from Brian Fitzgerald < fitzgb@mml0.meche.rpi.edu > ... figure(1) set(1,'Position', [ 10 10 610 610]) 1.3.1.5. How do I manipulate colormaps? When you use a function that calls a colormap, the function assigns values in the matrix to certain values in the default colormap. The lowest value in your matrix is assigned to the first color in your colormap. There is a colormap command in MATLAB, which allows you to set your colormap to 10 different sets of colors. For example, colormap cool gives you shades of cyan and magenta while colormap jet gives you shades of blue. You can set a limit on your colors using the functions caxis , cmin , and cmax . These functions let you define the range of colors you will be using. 1.3.1.6. Is there a topical help function, like 'apropos'? Yes. The function you're looking for is lookfor (in MATLAB 4). >> lookfor fourier FFT Discrete Fourier transform. FFT2 Two-dimensional Fast Fourier Transform. IFFT Inverse discrete Fourier transform. IFFT2 Two-dimensional inverse discrete Fourier transform. FOURIER Graphics demo of Fourier series expansion. DFTMTX Discrete Fourier transform matrix. 1.3.1.7. How can I get information about undocumented functions (like comet) in MATLAB? Most things in the /demos directory are not described in the MATLAB User's Guide. There are lots of goodies there. In 4.0, the demos are the best place to see examples of Handle Graphics. There are other undocumented functions in directories other than /demos . Some of them are "worker" functions that are unlikely to be used directly; they are simply called by other functions. A few, like comet and comet3 , were written after the MATLAB User's Guide was sent to the printer. 1.3.1.8. How does the Random generator work? The algorithm for the rand function can be found in S. K. Park and K. W. Miller, "Random Number Generators: Good ones are hard to find," Comm. ACM, vol. 32, n. 10, Oct. 1988, pg 1192-1201. The formula used for the seed is: seed=(7^5*seed)mod(2^31-1) If you want to set the initial seed to an random value, type the following at the MATLAB prompt: rand('SEED',fix(100*sum(clock))) This will use the clock to set the seed. 1.3.1.9. Is there a Pseudo-Random Binary Sequence (PRBS) generator in MATLAB? There is a PRBS generating M-file in the new Frequency Domain System Identification Toolbox, for lengths 2^2-1 to 2^30-1. Its name is mlbs (for Maximum Length Binary Sequence). 1.3.1.10. What is the numeric precision of MATLAB? In MATLAB, numeric quantities are represented as double precision floating point numbers. On most computers, such numbers have 53 significant binary bits, which is about 15 or 16 decimal digits. 1.3.1.11. How do I run MATLAB in batch mode? Here is an example of how to run MATLAB in batch mode from your UNIX prompt: Bourne shell example: (file called atfile.sh ) TERM=; export TERM matlab > inline.out << EOF a = [1 2] quit EOF Sample at command on Sun: (-s says use the Bourne shell) % at -s now + 1 min atfile.sh C shell example: (file called atfile.csh ) setenv TERM matlab >! inline.out << EOF a = [1 2] quit EOF Sample at command on Sun: % setenv SHELL '/bin/csh -f' % at now + 1 min atfile.csh % setenv SHELL /bin/csh In summary, Define TERM in the script before you call MATLAB and make it part of the environment. Be sure that the right shell is used to execute the script. If your script is a C shell, you must do the SHELL change in order not to get any extra mail messages from the job. remember that -f means that your .cshrc file will not be executed before you run the script. So, you cannot use any of the parameters set in the script. 1.3.2. Matrices 1.3.2.1. What is the largest matrix MATLAB can handle? MATLAB itself has no limits on matrix or vector sizes. There are no fixed-size arrays dimensioned within the MATLAB program. MATLAB uses the dynamic memory allocation and virtual memory facilities provided by most operating systems to obtain its memory. Any limits on memory and hence matrix size are those imposed by the operating system or the hardware. On most computers, these limits can be set arbitrarily large by the user or the system manager. The Student Edition version is limited to variables of size 32 by 32. 1.3.2.2. How does MATLAB index its matrices? MATLAB began as a FORTRAN program and we have kept the convention of beginning our indices at one instead of at zero. You also cannot have negative indices to vectors of matrices. 1.3.2.3. Can MATLAB handle multidimensional arrays? Many MATLAB users commonly ask the question, "Can I use multidimensional arrays in MATLAB?" The anwser is both yes and no. No, in that multidimensional arrays are not built into MATLAB. MATLAB's internal data stucture is limited to a two-dimensional matrix. But you can create your own functions in the MATLAB language to handle multidimensional arrays. The following is an example that maps a three-dimensional matrix to a single vector. The indices are passed to a function as if it were a three-dimensional matrix. Then the indices are translated to a single vector with corresponding offsets. The exact implementation will be specific to what you want to accomplish. function position = index3(d,i,j,k) %INDEX3 POSITION = INDEX3(d,i,j,k) index a 3-D array % d is a vector that specifies the dimensions on the array position = (i+(j-1)*d(2)+(k-1)*d(2)*d(3)); The following is an example of how you might use this function. D = [9 9 9]; % D give the dimensions as 9x9x9 A = 1:(9*9*9); % A is where your 3D data is % stored A(index(D,5,4,4)) = 77; % Write to it B = A(index(D,5,4,4)); % Read from it You can create N-dimensional arrays with different limits on each dimension. The main difference is that you would change how the offset is indexed through your matrix. Each additional dimension would require a corresponding offset. You can add error checking for the indices to make sure you do not go out of bounds. 1.3.2.4. How can I initialize a low rank matrix easily? Here's "Tony's trick," attributed to Tony Booer of Schlumberger: To initialize a matrix with values "a" in the first row and values "b" in the second row, do the following: [a(1,ones(1,m)) ; b(1,ones(1,m))] 1.3.3. Functions 1.3.3.1. Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted? When you write an M-file in MATLAB, you can either write a script or a function. The difference is that a script is read from the disk and parsed line by line each time it is called. A function is loaded into RAM for execution. Because it is loaded into RAM, when you edit a function, that change is not loaded into RAM until a call to the new function is made. To get MATLAB to recognize your edited function, type clear functions to clear all functions, or clear to clear just your function out of RAM. 1.3.3.2. How can I get the parser to accept a dummy reference without an error? MATLAB parses code to look for syntax errors. When the parser encounters a name with two or less arguments, it lets them pass since they might be a variable with indices. If it encounters a name with three or more arguments, MATLAB knows it cannot be a variable, so the error message is returned. If you don't want the parser to snag the function, specify one with twp or less arguments. 1.3.3.3. Is there a GNU emacs editing mode for MATLAB? A GNU emacs 'matlab-mode' is available via anonymous ftp from csi.jpl.nasa.gov as pub/matlab/util/matlab-mode.el or, ftp.mathworks.com as /pub/contrib/tools/matlab-mode.el. 1.3.3.4. Does MATLAB have a debugger? Yes, MATLAB does have a debugger. To find out more, type help debug at the MATLAB prompt. 1.3.4. eval Command 1.3.4.1. How does the eval command work? The eval command evaluates any expression given as its input. This is described in detail in a technical note which can be found on the ftp server in pub/tech-support/tech-notes/mat3.txt. 1.3.4.2. How can I use a filename that is a variable as an input argument to the load, save, and print functions? name = 'xyz.mat'; eval(['save ', name]); eval(['load ', name]); name = 'myfigure.ps'; eval(['print ',name]); 1.3.5. MATLAB Functions 1.3.5.1. Why was fsolve removed from MATLAB Version 4? The algorithms used by fsolve were not numerically well behaved. MathWorks did not feel that these algorithms met the standards required for approved software. We recommend the version of fsolve in the Optimization Toolbox . If your site doesn't have the Optimization Toolbox, you can get the old version of fsolve from ftp.mathworks.com in /pub/contrib/optim/fsolve35. 1.3.5.2. What is griddata? How do I use it to contour irregularly spaced data? griddata is a function that interpolates your data to generate evenly spaced data for plotting. Example: x,y,z => irregularly spaced data xmin=min(x); ymin=min(y); xmax=max(x); ymax=max(y); xi=xmin:0.02*(xmax-xmin):xmax; yi=ymin:0.02*(ymax-ymin):ymax; zi=griddata(x,y,z,xi',yi); contour(xi,yi,zi) 1.3.5.3. What is the sign convention used in MATLAB's fft routines? The fft in MATLAB is defined as sum(x(i)*exp(-j*i*k/N)) and not sum(x(i)*exp(j*i*k/N)). The first version is traditionally used by engineers, the second version by mathematicians. 1.3.5.4. How do I fit a curve in MATLAB? There are many ways to fit a curve in MATLAB. The most common is to use polyfit to fit your data to a polynomial. Here is an example of how to use polyfit to fit data: x = 1:10; y = exp(x); % create exponential data to be fitted c = polyfit(x,y,9); % generate coefficients for a fitted % polynomial of degree 9 yfit = polyval(c,x); % evaluate the polynomial at x plot(x,y,'yo',x,yfit,'r-') % plot the results There is a technical note on fitting a function to data using leastsq which can be found on the ftp server under pub/tech-support/tech-notes/math4.txt. 1.3.6. File I/O 1.3.6.1. How do I use fread, fwrite, and fprintf? fread , fwrite , and fprintf are all similar to their C counterparts and are used to read and write data to a file. Each of these requires the use of a file identifier. These functions allow you to specify the format in which you would like your data read or written. To find out more, take a look at the online help available for these functions. Also, there is a technical note describing how to load and save data in MATLAB which can be found on the ftp server under pub/tech-support/tech-notes/io1.txt. 1.3.6.2. How can I store the result of ls *.dat in a variable? [tmp,list] = unix('ls *.dat'); 1.3.7. Differential Equations 1.3.7.1. Can MATLAB solve Ordinary Differential Equations (ODE)? MATLAB has four basic functions to solve ODE's, quad , quad8 , ode23, and ode45 . quad uses an adaptive recursive Simpson's rule, quad8 uses an adaptive recursive Newton Cotes 8 panel rule, and ode23 uses the Runge-Kutta method. In addition to ode23 , there is an ode45 function, which uses a 4th and 5th order Runge-Kutta as opposed to ode23 's 2nd and 3rd order. 1.3.7.2. How do I pass in extra parameters to ode and quad? ode23 and ode45 are called as follows: = ode45('yprime', T0, Tfinal, Y0) where the inputs to the function are: F - String containing name of user-supplied problem description. Call: yprime = fun(t,y) where F = 'fun' . t - Time (scalar). y - Solution column-vector. yprime - Returned derivative column-vector; yprime(i) = dy(i)/dt. t0 - Initial value of t. tfinal- Final value of t. y0 - Initial value column-vector. tol - The desired accuracy. (Default: tol = 1.e-6 ). trace - If nonzero, each step is printed. (Default: trace = 0 ). The call to quad and quad8 is as follows: Q = quad8(F,A,B,TOL,TRACE) However, if you want to pass extra parameters to the function, do as follows: Q = quad8('F',A,B,TOL,TRACE,P1,P2,...) This allows coefficients P1, P2, ... to be passed directly to function F: function g=f(a,b) G = F(X,P1,P2,...). To use default values for tol or trace , you can pass in the empty matrix. For more information, take a look at the technical note on this topic. It can be found on the ftp site in pub/tech-support/tech-notes/math1.txt. 1.3.7.3. How do I do double integration in MATLAB? A technical note has been written on how to do double integration in MATLAB. It can be found on the ftp site in pub/tech-support/tech-notes/math2.txt. 1.3.8. Memory 1.3.8.1. What can I do when MATLAB tells me I'm out of memory? If the OUT OF MEMORY error message is encountered, there is no more room in memory for new variables. You must free up some space before you can proceed. One way to free up space is to delete some variables (see clear ). Another is to issue the command pack (see pack ). pack compresses the data in memory, and open up larger contiguous blocks. Here are some additional system specific tips: MS-Windows: Increase the swap space by opening the Control Panel, double-clicking on the 386 Enhanced icon, and pressing the Virtual Memory button. Macintosh: Under Multi-Finder, change the application memory size by using Get Info on the program icon. Under Single-Finder, install more memory. VAX/VMS: Ask your system manager to increase your working set. UNIX: Ask your system manager to increase your swap space. 1.3.9. Student Edition 1.3.9.1. Why does my Student Edition hang my machine after the MATLAB banner is displayed? This happens from time to time, depending on your machine, because the binary codes for MATLAB are different from machine to machine. There is only one version of Student Edition for PC's. Here are two fixes for the problem: OPTION 1: Edit the matlab.bat file, add the following line above the pcmatlab line, set N087=1 , so it will look like this: set NO87=1 (there are no spaces on either side of the =, and that is a letter O not the number 0.) pcmatlab ..... OPTION 2: Go to the MATLAB bin directory (cd matlab/bin) Copy PCMATLAB.EXE to PACMATLAB.ORG. Rename PCMATLAB.EXE to PCMATLAB.DAT (using the DOS ren command) At the DOS prompt, type debug pcmatlab.dat and press enter. You will be at the left margin with a minus sign. At the minus, type rcs and it will return CS xyyy where x and y are numbers. You will then be at the colon prompt. At the colon prompt, hit return and you'll get back the minus prompt. At the minus prompt, enter e zyyy:11 where z=x+3, then press return. You should get back zyyy:0011 25 . Immediately following zyyy:0011 25 . type D followed by a space. This should return 3C. on the same line. Immediately following 3C. type 3F followed by a space. This should return FF. on the same line. Immediately following FF. , type 0 (zero) and press return. You will be back at the minus prompt. Enter w and press return. The text Writing 51F92 bytes will be displayed and you will be back at the minus prompt. Enter q and press return. You will be back at the DOS prompt. Rename PCMATLAB.DAT to PCMATLAB.EXE (using the DOS ren command). 1.3.9.2. How do I print using the Student Edition? Directions on how to print using the Student Edition of MATLAB can be found in the Student Edition manual on pages 27-28.  2. Graphics 2.1. Using get and set 2.1.1. What is a handle? A handle is a number assigned by MATLAB to a graphics object. For example, you can have a handle to each object in a plot that contains many objects such as lines, patches, and surfaces. Once you know the handle to an object, you can alter its properties. To find out what properties are associated with each object, see axis , figure , line , patch , surf , root , and image . If you wanted to get the handle to a line when you plot it, you would do the following: handle=plot(x,y) 2.1.2. How do I use get and set? You can either get or set a property of an object in the following manner: get(handle,'PropertyName') set(handle,'PropertyName','PropertyValue') Two common handles are gca and gcf which stand for 'get current axes' and 'get current figure', respectively. If you use gca or gcf as the handle in your get or set statement, you will be able to change the properties of the current figure or current axes without previously defining their handles. For more information, look at the MATLAB technical note written on this topic. It can be found on the ftp site in pub/tech-support/tech-notes/gr12.txt. 2.1.3. What properties can I control? To find out about an object's properties, type the following: set(handle) This returns a list of all the properties associated with that object as well as each property's optional settings. The settings in { } are the default settings. 2.1.4. How do I change the default settings for an object's properties? To set the default setting for an object, you first need to know the ancestor of the object whose property you wish to set. To find the parent of an object, type the following: h=get(object's_handle,'Parent') To set the default, type the following: set(h,'DefaultObjectPropertyName','PropertyValue') Don't put any spaces in the DefaultObjectPropertyName expression. A good example of how to do this is the following: set(gca,'DefaultLineLineWidth',10) Any line you plot after this statement will have a line width of 10. 2.1.5. How do I change the default settings back to their original settings? Set the default settings just as explained above, but use factory for the property value. For example, if you changed the default line width to 10 as above and then you wanted to set it back to the original setting, you would type: set(gca,'DefaultLineLineWidth','factory') 2.2. Properties of the Figure and the Axes 2.2.1. Fonts How do I change the font of labels? When you change the default font name and font size, the factory settings will still be used when drawing the title and lables on the screen. Following is a modified xlabel , ylabel , zlabel , and title to recognize changes to the default FontName and FontSize ; however, it would be just as easy to have it recognize changes to all the default text font properties. Below are the revised programs: <------- XLABEL.M -------> function xlabel(string) % XLABEL X-axis labels for 2-D and 3-D plots. % XLABEL('text') adds text below the X-axis on the current % axis. % % See also YLABEL, ZLABEL, TITLE, TEXT. % Copyright (c) 1984-92 by The MathWorks, Inc. h = get(gca,'xlabel'); ht = get(text,'fontname'); hs = get(text,'fontsize'); if isempty(h) h = text('HorizontalAlignment','center'); set(gca,'xlabel',h); end set(h,'string',string,'fontname',ht,'fontsize',hs); <------- YLABEL.M -------> function ylabel(string) % YLABEL Y-axis labels for 2-D and 3-D plots. % YLABEL('text') adds text beside the Y-axis on the current % axis. % % See also XLABEL, ZLABEL, TITLE, TEXT. % Copyright (c) 1984-92 by The MathWorks, Inc. h = get(gca,'ylabel'); ht = get(text,'fontname'); hs = get(text,'fontsize'); if isempty(h) h = text; set(gca,'ylabel',h); end set(h,'string',string,'fontname',ht,'fontsize',hs); <------- ZLABEL.M -------> function zlabel(string) % ZLABEL Z-axis labels for 3-D plots. % ZLABEL('text') adds text above the Z-axis on the current % axis. % % See also XLABEL, YLABEL, TITLE, TEXT. % Copyright (c) 1984-92 by The MathWorks, Inc. h = get(gca,'zlabel'); ht = get(text,'fontname'); hs = get(text,'fontsize'); if isempty(h) h = text; set(gca,'zlabel',h); end set(h,'string',string,'fontname',ht,'fontsize',hs); <------- TITLE.M -------> function title(string) % TITLE Titles for 2-D and 3-D plots. % TITLE('text') adds text at the top of the current axis. % % See also XLABEL, YLABEL, ZLABEL, TEXT. % Copyright (c) 1984-92 by The MathWorks, Inc. h = get(gca,'title'); ht = get(text,'fontname'); hs = get(text,'fontsize'); if isempty(h) h = text('horiz','center'); set(gca,'title',h); end set(h,'string',string,'fontname',ht,'fontsize',hs); For more information, see the MATLAB technical note written on this topic. It is located on the ftp site in pub/tech-support/tech-notes/gr2.txt. 2.2.1.1. How do I change the font of text objects? To change the font name or font size of a text object, do the following set(h,'FontName','font') where h is the handle to the text object, and font is the name of the font you wish to use. For more information, see the MATLAB technical note written on this topic. It is located on the ftp site in pub/tech-support/tech-notes/gr6.txt. 2.2.1.2. How do I change the font of tick labels? Although undocumented, all the standard text object font properties such as FontName , FontBold , and FontItalic are also properties of axes. For example, typing: set(gca,'FontStyle','courier') will change the font of x and y tick labels before they are created. To change the font of existing labels, do the following: h=get(gca,'Xlabel'); set(h,'FontName',font); For more information, see the MATLAB technical note written on this topic. It is located on the ftp site in pub/tech-support/tech-notes/gr10.txt. 2.2.1.3. How do I get Greek letters in my text objects? You can obtain Greek characters from the symbol font. To implement: h=text(x,y,'string') set(h,'FontName','courier'); or set(gca,'FontName','symbol'); text(x,y,setstr(num)); where x and y are the coordinates on the graph where you want to place the Greek symbols, and num is the value from the list of 0-255 characters from the symbol font. To display a table of the symbol font, you can use the following M-file called chart.m. function chart( fontname ) % CHART Show ANSI-chart like display of characters MATLAB %can produce. % CHART( 'fontname' ) will put up a figure % window with all 255 % characters of the named font in a 16x16 grid. % Close figure when done, it creates 256 text % objects. You may want % that memory back! % Chuck Packard, The Mathworks, Inc., 25 Jan 93 % This is an unsupported, purely for example, M- % file. % % % TO USE THIS CHART: % USE SETSTR( VALUE), WHERE VALUE=( (16*XCOORD)+YCOORD) % % % make a new figure and axis % (I'm assuming you want to keep the current graph in the % gcf.) % figure; axis([-1 16 -1 16]) ax = gca; % %set font to be used % set(ax, 'DefaultTextFontName', fontname ) % %some other Handle Graphics settings, written out in %full. %See manual for more info. % set(ax, 'YDir', 'Reverse', 'Box', 'on') set(ax, 'YTick', 0:15, 'XTick', 0:15) set(ax, 'DefaultTextHorizontalAlignment', 'Center') set(ax, 'DefaultTextVerticalAlignment', 'Bottom') % %not vectorized like all 'good' MATLAB M-files, but %easier to understand! % x = reshape( 0:255, 16, 16 ); for h=1:16 for v=1:16 text(h-1,v-1,setstr(x(v,h))); end end 2.2.1.4. Can I have multiple fonts in one text object? No, you cannot mix fonts, font styles, or font sizes within a text object. 2.2.2. Lines 2.2.2.1. How do I change the line width? To change the line width, do the following: set(h,'LineWidth',size) where h is the handle to a line and size is the width you want. The default line width is 0.5. 2.2.2.2. How do I change the line style order on printouts? The following is an M-file that allows you to cycle through the line styles in the order you want when you print: function prtlines(a1,a2,a3,a4,a5) % PRTLINES is a front-end to PRINT which converts % solid lines to various line styles for graphical % output. The change is transparent to the user. % Non-solid lines are not affected. % % PRTLINES is used in the same manner as PRINT. % % The default line styles are: % % '. ' % 'o ' % 'x ' % '+ ' % '- ' % '* ' % ': ' % '-.' % '--' % % The line style can be changed by editing the file % and changing the 'styles' array. % % SEE ALSO: PRINT, Properties of LINE % Written by John L. Galenski III % All Rights Reserved 10/14/93 % LDM101493jlg %% PRTLINES is an M-file developed by me for my own %% personal use, and therefore, it is not supported %% by The MathWorks, Inc., or myself. Please direct %% any questions or comments to johng@mathworks.com. % Create the array of line styles. styles = [ '. ' 'o ' 'x ' '+ ' '- ' '* ' ': ' '-.' '--' ]; % Get the Children of the Figure. a = get(gcf,'children'); % Check the Children of 'a'. If they are % solid lines, then change their LineStyle % property. for j = 1:length(a) l = sort(get(a(j),'children')); X = 0; Add = 0; for i = 1:length(l) if strcmp( 'line', get(l(i), 'type' )) if strcmp(get(l(i),'linestyle'),'-') X = X + 1; LINE = [LINE;l(i)]; SI = rem(X,length(styles)); if SI == 0 Add = 1; end set(l(i),'linestyle', styles(SI+Add,:)); end end end end % Construct the PRTCMD. PRTCMD = 'print'; for x = 1:nargin PRTCMD = [PRTCMD,' ',eval(['a',int2str(x)])]; end % Discard the changes so that the Figure is not % updated. drawnow discard eval(PRTCMD) % RESET THE LINESTYLES set(LINE,'linestyle','-') % Discard the changes so that the Figure is not % updated. drawnow discard 2.2.2.3. How do I cycle through the line color order? You can set the default color order for the axes by doing the following: set(gca,'ColorOrder',A) where A is an RGB vector of any length. 2.2.3. Positions 2.2.3.1. How do I change the size and position of my figure window? There is a property of the figure window called Position where the x-position, y-position, width, and height are stored. To change this, do the following: pos=[x_position, y_position, width, height]; set(gcf,'Position',pos) 2.2.3.2. How do I define an invisible axis? There is a property of the axis called Visible . You can set Visible to off as follows: set(gca,'Visible','off') This is very useful if you want to place text in the figure window with respect to the borders of the figure, rather than with respect to the axes. 2.2.3.3. Which units should I use? There are five different types of units you can use: inches, centimeters, normalized, points, and pixels. To make sure what you get out of your printer looks like what you have on your screen, we recommend using normalized units. 2.3. Background Color 2.3.1. How do I invert the background on my printout? set(gcf,'InvertHardCopy','on') 2.3.2. How do I change my background for plots? To change the background color of your plot from black to white, type cinvert at the MATLAB prompt. To make the default setting white, place the following line in your startup.m file whitebg To change the color of your figure window to something other than black or white, type the following: set(gcf,'Color','red') 2.4. Using MATLAB Graphs with Other Packages 2.4.1. Can graphics be saved as files to be imported back into MATLAB for viewing and alteration? Yes, in MATLAB version 4.2. A new print command device driver option allows you to save and reload a figure. The command print -dmfile creates two files, filename.m and filename.mat. The M-file contains the necessary object creation and set commands to reproduce the figure. The generated MAT-file also contains the figure data. Handle values are not maintained. 2.4.2. Can I edit MATLAB graphs in other applications? In MATLAB version 4.2, graphs are produced in such a way that, if your application allows you to view the imported figure, you can edit it. 2.4.3. How do I copy and paste MATLAB graphs to the clipboard? To copy and paste MATLAB figures to the clipboard, select Edit from the menu at the top of the Figure window. Then select Copy. Your figure now exists in the clipboard. To paste, simply choose Paste from the Edit menu in your application. 2.5. Graphical User Interface (GUI) 2.5.1. How do I make a dialog box? MATLAB version 4.2 has some functions that will help you do this. See help on dialog for more information. 2.5.2. How do CallBacks work? What is the best way to write a CallBack? A CallBack is the specified action that MATLAB performs when the user selects the menu item to which the CallBack has been assigned. When the button or menu item is selected, the expression contained within the CallBack string is executed. For example: h=uicontrol('Style','PushButton','String','title',... 'CallBack','disp(''hello'')')' When you push on the button, hello will be displayed in the MATLAB workspace. The most efficient way to write a CallBack is to make the CallBack a function. That way, the function is stored in RAM and will execute more quickly if you are going to be using the button often. 2.5.3. Where do CallBacks get executed? CallBacks get executed in MATLAB's main workspace. 2.6. Miscellaneous 2.6.1. Why does waterfall return a blank screen? There is a bug in the waterfall routine which prevents the edgecolor from being accurately represented. To work around this, issue the following two commands: h=waterfall(peaks); set(h,'edgecolor','w') This will make the edgecolor for the whole waterfall a constant color and allow printing as well as display. 2.6.2. How do you get perspective with 3-D plots? To change the ratio of the axis in a 3-D plot, you will need to change the xform property of the current axis. The property transforms the 3-D data to be plotted on the 2-D screen. The following M-file will do the trick. function aspect3(x,y,z) v = get(gca,'xform'); d = diag([x y z 1]); set(gca,'xform',v*d); 2.6.3. Why does MATLAB sometimes draw patches out of order? MATLAB determines the order in which patches are drawn by using the Painter's Algorithm. It determines which patch to draw first by determining which vertices of each patch are closest to you, the viewer. If a few patches have overlapping vertices, then MATLAB must choose which patch to draw first. Sometimes it chooses incorrectly. 2.6.4. How do I use multiple colormaps? Here is an example: % Place a gray PCOLOR of PEAKS and hsv SURF of PEAKS in % the same plot. clf hold off % Set the colormap colormap([gray(30);hsv(30)]) % Generate the data = peaks(30); % Create the Cdata for the PCOLOR and SURFACE plot. % The Cdata for each plot should be contiguous, and % not overlap. This will guarantee that they use % different regions of the colormap. cd1 = z + abs(min(min(z))); cd2 = cd1 + max(max(cd1)) + 1; % Place the PCOLOR P = pcolor(cd1); shading interp % Change the location so that it will be visible when % the SURFACE is drawn set(P,'zdata', -30*ones(size(get(P,'zdata')))) hold on % Place the SURFACE plot S = surf(1:30,1:30,z,cd2); % Change the location so that it does not overlap the % PCOLOR %set(S,'zdata',15+get(S,'zdata')) % Change the Clim used by AXES set(gca,'clim',[min(min(cd1)), max(max(cd2))]) % Make sure that the VIEW and AXES limits are correct view(3) axis([1 30 1 30 -30 30]) % Rules that you need to follow when doing this. % % 1) The Cdata values for each plot should % not overlap. % % 2) The range between the minimum and maximum % values in Cdata should be the same for each % plot. % % 3) The Cdatas must be contiguous. % % 4) Set Clim for AXES to range from the % smallest and largest values of the 2 Cdatas. 2.6.5. What is the difference between pcolor and image? Each element in the image's CData is used to color a rectilinear patch. The data contains the row of the colormap used to color the patch. pcolor is a surface plot and its CData is scaled into the colormap. Each element of the CData corresponds to a vertex in the plot. Therefore, the number of rectangles in pcolor is always one row and column smaller than the actual data.  3. Printing 3.1. General 3.1.1. How do I print in MATLAB? To print a figure window from the command line, type print . If you would like to use any of the options, type print -