2010年4月16日星期五

Scilab: Read file

When the data file is too large, one cannot read all of them into stack. Instead one has to read line by line and only put those usefull data into stack. To read a data file line by line, one can do it in the following way.

fid = mopen('D:\WORK\pe1.TXT', "r");
while (done_yet == 0);
[num_read, val(1), val(2)] = mfscanf(fid, "%f %f");

... ...

if (num_read <= 0);
done_yet = 1;
end
end;

Firstly, open the file.
Then read data in format from one line.
Deal with the data.
If the file is not end, continue reading.

Scilab: Increase stacksize

stacksize()

This command will return two numbers. The first one is the current stacksize, and the second one is how much in use. One can give these values to a variable by

v = stacksize()

To increase the stacksize, use

stacksize(n)

where n is a number that is the stacksize that one wants to set.

2010年3月17日星期三

WPS:插入矢量图形

有时候想要整理一下数据,写一些简单的总结,又没有很多公式要输入时,就不想用Latex了。而且Latex的表格不方便。(学会lyx之后也许可以解决这个问题。)这时候就想用WPS。

WPS默认的版本不能插入eps格式的矢量图。上网搜索了一下,有人为WPS写了一个插入矢量图的插件。原帖见WPS office论坛,链接在此。下载并安装那个插件之后,在WPS的“插入”菜单下面多了一项“插入矢量图形”。我尝试了一下,至少eps格式是可以的。

Scilab: 画二维曲线时如何加入误差

只要在原本的plot命令后面,再加入下面的这条命令:

errbar(x,y,em,ep)

parameters:
x:横坐标 horizontal coordinates
y:纵坐标 vertical coordinates
y-em:误差下限 lower error limits
y+ep:误差上限 upper error limits

2009年8月17日星期一

Latex:多行公式使用同一个编号(等号对齐)

\usepackage{amsmath}


...
\begin{equation}
\begin{split}
x = & a \\
=& b.
\end{split}
\end{equation}

2009年8月11日星期二

Latex: 在公式中使用黑体的希腊字母

有时候在书写数学公式是,希望使用黑体的字母。普通字母可以使用\textbf{}来显示黑体。但是希腊字母不能用这个命令,编译会出错。但可以使用\boldsymbol{}命令。例如:\boldsymbol{\pi}。使用这条命令时,需要在文档头引用amsmath包:\usepackage{amsmath}。

Latex:多个公式使用同一个编号(右对齐)

\usepackage{amsmath}


\begin{equation}
\begin{aligned}
equation 1 ... \\
equation 2 ... \\
equation 3 ...
\end{aligned}
\end{equation}

生成的公式只有一个编号,并且自动右对齐。