Wednesday, March 3, 2010

conflict command in linux: matlab mex with mex from pdflatex

In the Ubuntu, two commands have same name. The way to solve this problem is to use command name with whole directory, e.g, /opt/matlab/bin/mex. You can use this whole name instead of short name "mex" in the Makefile.

Thursday, January 14, 2010

Linux Matlab and German keyboard

The new linux version matlab (e.g. R2008, R2009) can not work with german keyboard, it works following the english keyboard map.
I have tried a lot method and it still can not work until today (great day)!
When I run matlab, it show me a error message:
"
********************************libjvm.so
[0xb31ab8ec]
Locking assertion failure. Backtrace:"

It can not lock the java. The reason is it find the wrong one. The solution is run a command shell and type:
"export MATLAB_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.17/jre
"

Now it correctly show the character of the german keyboard. Of course, you may have different version of JAVA and install directory that you must figure out, and use yours instead mine. You also can add this command to your "~/.bashrc" file, so that every time you login, you donot have to run this command manually.


But the symbols "^" and "~" still can not work in this Linux. I test this method on Windows Vista, both symbols can work.
On Vista, open a command prompt, then use command setx to set the variable MATLAB_JAVA:
"setx "MATLAB_JAVA" "C:\*************""

Tuesday, January 5, 2010

Gradient of image and hough transform

直线参数表达式:rho=x*cos(theta)+y*sin(theta);

rho 是 从原点到直线的法线垂直距离。theta 是该法线和X轴正向夹角。所以利用HOUGH TRANSFORM的时候,要注意,theta不是直线的倾斜角或者它的正切不是切向量,而是法向量。设直线斜率是K=-1/tan(theta);

Thursday, December 10, 2009

How to print nice figure on matlab

Here is an example that can print current figure to a eps file with DPI=300 .

figure;
print(gcf, '-depsc','-r300', figname);

"gcf" means the current figure. "-depsc" means save as eps color image. "-r300" means 300dpi, "figname" should be something like "name.eps"

Monday, December 7, 2009

Mimimum distance from point to a curve

1. Assume we already know the function of curve: y=f(x); Given a point p(x1,y1), calculate the minimum distance:

D=sqrt((x-x1)^2+(y-y1)^2);

D*=(x-x1)^2+(y-y1)^2;

substitute y by f(x);

D*=(x-x1)^2+(f(x)-y1)^2;

Compute the derivative of D* and set it to zero: D*'=0, then we can solve x; substitute x , we get minimum distance D*;

2. The other one is no function expression of curve. We need calculate all points.

Monday, November 16, 2009

Convert bib file to bbl file

I have a bibliography database file which was created by kbib. I want to use it on latex. In the tex file, I add

"
\bibliographystyle{plain}
\bibliography{bibfile}
"
just begin the end of documentation.

When I first compile the file, it told me it can not find reference .bbl file. So I use bibtex to build a .bbl file which can be used in latex.

$ bibtex filename.aux


here .aux was created by first run of latex. It automatically transfer data from bibfile.bib to filename.bbl by filename.aux.

It's great. Because you just need one database, then you can use it forever.

Thanks latex.

No bounding box.

! LaTeX Error: Cannot determine size of graphic
in ... (no BoundingBox).



Today I encounter this problem when I play with latex-beamer. The problem is that when I compile it I was using latex but not pdflatex...Because latex just can use .eps picture. The command pdflatex just accept .pdf, .png, except .eps.

After converting the image from png to eps, it works with latex. AFter converting eps to png, pdflatex also works.