Matlab 版 (精华区)
发信人: zjliu (Robusting), 信区: Matlab
标 题: 数学工具FAQ[smth]--第二节:Matlab常见问题3
发信站: 哈工大紫丁香 (Tue Dec 17 15:00:10 2002) , 转信
===================================
16).Matlab中为什么只能在小数点后显示四位?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #
用format命令来改变命令窗口数字的显示格式和精度,但不会影
响matlab的计算精度,matlab的矩阵运算默认都是双精度浮点型运算。
===================================
17).Matlab如何在命令窗口按照格式输出?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,SMTHTools #
fprintf(1,"your_format_string",var1,var2,…);
===================================
18).如何在Matlab中画隐函数曲线?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #
在http://www.mathworks.com/matlabcentral/fileexchange/index.jsp
查找implicit,会找到一个Arthur Jutan写的implot.m
Mathematica中绘制隐函数用ImplicitPlot[]
或者ImplicitPlot3D[]
Maple中为implicitplot(),implicitplot3d()
参见
http://engineering.dartmouth.edu/~fangq/MATH/download/source/
ImplicitPlot3D.htm
===================================
19).Matlab中什么函数可以删除矩阵的某一行或列?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #
A(j,:)=[]; %删除A的第j行
A(:,i)=[]; %删除A的第i列
===================================
20).Matlab中能开的最大数组是由什么决定的?
:# chenft (mike),2002/6/1, SMTH/MathTools #
I have had similar problems. Below is an explanation I received from
Ian Boyd
from Mathworks (just giving credit where credit is due) that explains
what's happening. You solution is to run matlab with the -nojvm mode.
"The heap memory system in JAVA consists of data and handle elements.
When you allocate a variable you get a handle and data. As long as
data has an associated handle, the JVM considers it valid and
will not clean it up.
However, when you call the clear function in MATLAB, all handles are
destroyed, and the data associated is now invalid. This means that
the JAVA engine can free up that data (garbage collection), but does
not mean that it will clean it up at that moment.
Calling the PACK command encourages JAVA to run the garbage collector
and de-fragment the memory. But it does not force it to (This is part
of the JAVA design). Even though the memory is 'freed' on the heap,
it is not actually free to the OS, it is only free to the JVM. Here
is one way to think of it:
[MATLAB]
[JAVA]
[OS]
MATLAB runs on JAVA (virtual machine), and Java runs on the OS
(physical machine). So when MATLAB is running in JAVA mode memory
allocations are requested from the JRE, not the OS.
One problem you may be running into is that the default maximum
JAVA heap size is relatively low ( <= 64 MB), so that is all the
memory one session of MATLAB will ever get on your system.
The good news is that you can increase this value. You will need
to create a java.opts file in $MATLAB/bin/$ARCH (or in the current
directory when you start MATLAB) and put the following command:
%%%BEGIN CODE%%%
maxHeapSize = 268435456
%%%END CODE%%%
This will give you 256MB of JVM memory and you can adjust the
parameter as needed.
Note: $MATLAB is the root directory and $ARCH is your system
architecture. This solution works on Windows as well as Solaris,
Linux,Alpha, and SGI. A similar operation is possible on IBM and
HPUX, but with a different syntax.
For the 1.1.8 JVM (Windows, Linux, Solaris, Alpha, SGI) our
defaults are:
minHeapSize = 16000000
maxHeapSize = 64000000
These are the structure field names in that correspond to
-ms and -mx, and the settings above are roughly 16MB and 64MB.
To investigate the Java heap a bit, ask via the following:
>> java.lang.Runtime.getRuntime.totalMemory
>> java.lang.Runtime.getRuntime.freeMemory
When the free memory hits zero, Java will double the heap size
(up to the maximum setting).
If you choose to run without Java, you will remove the overhead
of the middle man, but you will also lose some MATLAB functionality
(mostly graphics and the Editor). You will still have most
of the computational power though.
Without JAVA, memory management will come directly from the OS,
and a CLEAR operation will result in memory being freed back to
the OS.
--
※ 来源:.哈工大紫丁香 http://bbs.hit.edu.cn [FROM: 202.118.229.86]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.383毫秒