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 .
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.
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. 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])
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.
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.
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. 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.
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).
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.
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.