Sunday, December 16, 2007

Print PDF files in black and white

Under MAC OSX, adobe reader doesn't allow you to choose whether to print in black&white or in color. Use Preview instead. The steps are as such
1. Print
2. Color Sync
3. Quatz filter: Black & White

Wednesday, December 5, 2007

1. erase all configureations in Cisco routers:
erase start

2. Initial configuration of Cisco routers:
2.1 no ip domain lookup and logging synchronous
2.2 set an ip address on one interface along with the vty password, so that I can telnet myself.
2.3 set "enable secret", keep enabled, telnet myself using the address configured above to test the password.

Tuesday, December 4, 2007

position of boxes in LaTaX

Take one kind of box for example, the minipage box.

\begin{minipage}[position]{width}

There are 3 options for "position" , namely , c, t, b, meaning centre, top and bottom correspondingly.
If 'c' is chosen, the vertical center of the minipage will be aligned to the baseline of the surrounding environment.
If 't' is chosen, the vertical top of the minipage will be aligned to the baseline of the surrounding environment.
If 'b' is chosen, the vertical bottom of the minipage will be aligned to the baseline of the surrounding environment.

Sunday, December 2, 2007

Referencing to a float in LaTeX

With \label and \ref, you can create a reference to a float within
your text. Note that the \label command must come after the \caption
command since you want it to reference the number of the caption.

Saturday, December 1, 2007

Using Chinese in TeXShop

TeXShop is the mac os version of TeXLive.
Using Chinese here is different from that in CTeX. I don't know exactly what happens yet, but I do know one way to use Chinese under TeXShop environment, which is followed:

\usepackage{CJKutf8}
\begin{CJK}{UTF8}{gbsn}
...
\end{CJK}

Monday, November 26, 2007

copy folders in sftp

[from http://www.cae.wisc.edu/site/public/?title=linux-sftp]
Recursive Copy

If you try to copy a folder using the get or mget commands, sftp will complain that it "Cannot download non-regular file: filename". This is because the basic sftp client doesn't allow for a recursive copy. However, the program scp will allow you to do this. The scp command will not allow you to see what's on the sftp server, so the files need to be located using the sftp client.

Note: the scp command is a Unix command, and needs to be run from the Unix prompt. NOT within the SFTP client.

Usage: scp user@host:remote-path local-path

scp is like the Unix command cp and should work similarly. To copy a file from your Unix home directory and put it in the working directory, use the following command:

scp @sftp.cae.wisc.edu:~/ ./

Where is your CAE username, and is the file you wish to copy. Enter your password when scp asks for it. scp works just like a get command in sftp.

To recursively copy files or directories from your CAE account, use the -r switch.

For example, to copy the entire directory "tutorial" from my CAE Unix home directory to the home directory on your machine, the following command would be used:

ComputerName:~ # scp -r username@sftp.cae.wisc.edu:~/tutorial ~/

Sunday, November 25, 2007

Use the following command:
wget -r -p -np -k {url}
where
-r means recursive
-p means page requisites
-np means no parent
-k means convert.

man wget to get the details

Monday, November 12, 2007

Rotating in LaTeX

\usepackage{rotating}
you can use three new environments:
1. \begin{sideways}
it will rotate the whole argument by 90 degrees counterclockwise. Moreover:
2. \begin{turn}{30}
it will turn the argument of 30 degrees. You can give any angle as an argument, whether it is positive or negative. It will leave the necessary space to avoid any overlapping of text.
3. \begin{rotate}{30}
like turn, but it will not add any extra space.

Thursday, November 8, 2007

Mutual Inductance in PSpice Schematics

Using pure Spice programming instead of PSpice schematics could easily puts an mutual inductance "K" between two inductors "L1" and "L2"by typing:
"K L1 L2 0.02"
where 0.02 is the coupling coefficient.
However, for no reason I decided to use PSpice schematics to analyze the crosstalk of several inductors, as illustrated in the figure below:

It is indeed easy to find out the part for mutual inductance in PSpice is "K_linear". However, when it came to specify "L1" and "L2", I became confused. After half an hour's searching on the internet, finally I got the answer from MIT open courseware.

Now let's do it step by step:
1.Double click the one of the K_linear element (it is suggested to click on the squared K)to open the property editor, as show in the following figure(In this example, I double clicked K2)

2.Now look at the columns with "L1" "L2" "L3" "L4" "L5" "L6" as headers, among which column header "L1" is for the primary inductor, the rest 5 columns are for secondary inductors. In this example, only the first two columns are needed for each "K_linear". As we can see from the last figure, the mutual inductors for "K2" is "L3" and "L4", thus what we need is to input "L3" under the first column, that is, the column of L1; input "L4" under the second column, that is , the column of L2.
3.Complete configuring the other K_linear using the principles above.

After all these efforts, I suddenly realized that I had never read any book about PSpice. From college what I had done was all based on the instruction sheet given by my teachers, which means my knowledge base for PSpice is far from enough. In fact, it can't even be called "Knowledge base", they are "Knowledge pieces". Next I need to seriously read one book.

At last, MIT open course ware is really great. Take use of it!!!

Sunday, November 4, 2007

1st Choice:

Use "curl"
for example:

curl -O http://www.jcedu.org/2/jq/dcd/mp3/[01-30].mp3

pay attention to the option "O" ,which means remote names. It will write output to local files with the same name as the remote files we get. Otherwise all data will be printed in the terminal, which means we will get nothing.

2nd Choice

Use "wget" by shell scripting
for example:

to get the same files as above, edit a script like this:

#!/bin/sh
for ((i=1;i<10;i++))
do wget http://www.jcedu.org/2/jq/dcd/mp3/0"$i".mp3 done for ((i=10;i<31;i++)) do wget http://www.jcedu.org/2/jq/dcd/mp3/"$i".mp3
done
exit 0

Wednesday, October 31, 2007

several tips for LaTeX

1. To crop image while including it:

\includegraphics[trim=l b r t,clip=true]{*.png}

where "l" means the length to me eliminated from the left of the image, while "b", "r", "t" means that from the bottom, right and top of the image.
to make trim work, clip has to be set as true.

2. \framebox and \lstinputlisting could be used together to produce a fancy output.

Monday, September 17, 2007

Remember

Thousands of people are suffering and dying while I write this, while you read this. How easy it is for us to ignore this obvious fact. How we easily lie to us that horrible things are highly impossible to happen to "me".

This life is short. Do not waste it!

Sunday, September 16, 2007

Make It Slow

Eight years ago, I realized that time is precious thus I should try my best to do every thing as fast as possible, in the meantime, never neglect even a tiny period of time, even the 10 minutes between classes. Later I found out that as a human being, I have to get some rest, so I did have some fun in the 10 minutes break. But the habit to do things fast has been kept until now, since it is actually a part of my born characteristics.

Usually when I did something very fast, I was driven by the strong desire to complete it. All the strong desires are a torture to our hearts.

Now, I realize another more important truth, that a peaceful heart is most enjoyable and couldn't be sacrificed for anything else. The fact is, when you do something under a peaceful heart without haste, you could do it more efficiently. This is a wise and natural choice after comparison.

Just keep yourself clear of what you are up against and what you should do, then do it one by one, step by step without any haste. Make it slow.

Thursday, September 6, 2007

Consequences

There are two ideas that I am impressed by in the movie Matrix.

The first one is the shock that the world we are living with our joy and sorrow suddenly becomes imaginary. Later I found a similar idea, which is more reasonable by the way, in what Siddhartha said more than two thousand years ago----Nothing you see, hear, smell, taste, feel, think or do is real. This idea I am not able to fully understand for now. Thus I'd like to illustrate the other one----Consequences.

In that movie, Merv says that "Where some see coincidences, I see consequences; Where others see chance, I see cost". Concequences(因果) is a too frequently used word in China that everyone knows it without paying attention to it. When someone riding a bicycle is hit by a car, people may probably consider it as an "accident",which is, of course, a coincidence. However, if you think about it, either the rider or the driver moves too fast, or they are just thinking something else without paying attention to the vicinity. The truth is, there is no such thing as coincidence. Every thing is the consequence of some and the reason of others. If a student doesn't solve the problems immediately after he meets them, the final exam will be a huge pressure; If a fish is seduced by the bait, it will probably end up with your food in the table. In fact mostly the relation between reasons and consequences are neither that clear nor direct, you'll have to be careful to think further. One thing leads to another.

When you want to do something, you'd better think about the possible consequences; When you are undergoing something or watching something terrible from any kind of media, think about the reasons under the surface, and if that is something you are possible to do, warn yourself, keep yourself from doing that, which is a natural choice.

Also when you are eager to accomplish something, think about the necessary conditions you need, and satisfy them. You don't even have to keep eagerous, just be totally clear about what you should do and do it. The consequence will come unavoidably.

Monday, April 23, 2007

matlab数字图像处理常用的函数

imread(‘filename’): 支持的格式有tiff, jpeg, gif, bmp, png, xwd.
imshow(f,G): f是图像文件,G是灰度级数,默认256级.
imfinfo: 了解图像文件的信息
imsubtract: 将两幅图像相减或从图像中减去常数
immultiply:将两幅图像对应像素相乘或图像乘以常数
imdivide: 两幅图像相除或图像除以常数
imabsdiff: 计算两幅图像间的绝对差
imcomplement: 对图像求补
imlincomb: 两幅或多幅图像的线性组合
imhist(f,b): f是图像文件,b是灰度级的个数
histeq(f,hspec): Enhance contrast using histogram equalization.其中f是输入图像,hspec是指定的直方图.
imfilter: 线性空间滤波
colfilt及nlfilt: 非线性滤波
fspecial: 生成线性空间滤波器
ordfilt2: 生成非线性空间滤波器
imnoise: 添加噪声
roipoly: 选择感兴趣的区域
checkerboard: 产生测试板图像
deconvblind: 盲去卷积
intransform:空间变换

Wednesday, April 18, 2007

有意思的传统节日

"六月六，请姑姑"。过去，每逢农历六月初六，农村的风俗都要请回已出嫁的老少姑娘，好好招待一番再送回去。

Tuesday, April 17, 2007

cepstrum and matlab

the signal processing tool box of matlab provides three functions for cepstrum analysis:
cceps: complex cepstrum
icceps: inverse complex cepstrum
rceps: real cepstrum

Monday, April 16, 2007

数值积分及matlab

1.　被积的是解析式，但原函数无法用初等函数表示
2.　被积的不是解析式，而是离散的矩阵

Newton-Cotes 公式、
Romberg 方法、
Euler-Maclaurin公式、
Gauss型求积公式

___________________________________________________________________

trapz使用的是梯形公式，trapezoid numerical integration

Thursday, March 8, 2007

Stationary Signals

1. General illustration
The first natural division of all signals is into either stationary or non-stationary categories. Stationary signals are constant in their statistical parameters over time. If you look at a stationary signal for a few moments and then wait an hour and look at it again, it would look essentially the same, i.e. its overall level would be about the same and its amplitude distribution and standard deviation would be about the same. Rotating machinery generally produces stationary vibration signals.
Stationary signals are further divided into deterministic and random signals. Random signals are unpredictable in their frequency content and their amplitude level, but they still have relatively uniform statistical characteristics over time. Examples of random signals are rain falling on a roof, jet engine noise, turbulence in pump flow patterns and cavitation. In fact, most random signals in nature could be treated as wide-sense stationary.
2. Mathematically
Reference to the picture from the article "The empirical mode decomposition and theHilbert spectrum for nonlinear andnon-stationary time series analysis" by Norden E. Huang et. al. Page 3

On Instantaneous Frequency

Instantaneous Frequency的定义是相位的导数，不是初相的，不可搞混