Showing posts with label scilab. Show all posts
Showing posts with label scilab. Show all posts

Tuesday, September 08, 2009

[SW] Python+SciPy+Matplotlib (installation and test)

There are many ways to use open source software and libraries to accomplish works which have been done by using Matlab. Oactve and Scilab might be two of the most well-known choices. Actually, my works don't need them very often and hence I don't know them well.

When I was reading some discussions about which one is ``better'' (okay, I know this question might be a stupid one), there are many information indicate that Python+SciPy+Matplotlib is a good combination to replace MATLAB. What I knew was Python, which occupied my weekend days to play around with. SciPy and matplotlib were new to me. I never heard about them but some screenshots showing their working results impressed me very much, so I decide to give them a try.

But it cost me more time than I expected. Orz (It's my own fault, not matplotlib's)

At the beginning, I installed the python-scipy, python-numpy and python-matplotlib via Synaptic Package Manager, and everything went smoothly. I just downloaded the examples and use python to see the plots. Good quality! And many formats including eps are available. When I tried to see the result given by a downloaded example (path_patch_demo.py), however, the python interpreter feedbacked error message said there was no so-called ``path'' module. I spent several minutes to figure out that the problem might caused by the version of my installations.

The newest version of the matplotlib is 0.99, and the one installed by Ubuntu was... 0.91.2! So I began to download newest version of matplotlib, SciPy and Numarray (Later, I found what I want to download is NumPy ,not Numarray, which is not supported anymore). Then, I followed the INSTALL files of the packages to find more other necessary packages. During the installation, I didn't follow all the instructions carefully and miss the libpng before installing the mataplotlib. Due to the mistake, the python interpreter said it cannot find TkAgg even the python-tk and tk8.4 have been installed (I'm not sure which one could be related to this problem).

Finally, I got new versions of the necessary libraries and can apply the examples with no problem.

Wow, it costed me several hours, but it's worth it because I learned more during the installing process.

---
Notes:
/usr/lib/python2.5/site-packages/matplotlib
/usr/lib/python2.5/site-packages/scipy
/usr/lib/python2.5/site-packages/numpy
Backend setting:
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc

Friday, May 22, 2009

[SW] Install the newest Scilab on Ubuntu

Here is a clear guidance shows how to install the newest stable Scilab from the binary package. I have just remove the Scilab-4.1.2 installed via Synaptic Package Manager, and installed the Scilab-5.1.1 downloaded from the website.

Everything looks smooth so far. At least the GUI interface looks better.

[SW] Scilab -- reading a data file

To read data files we have generated by other means into Scilab, use ``read'' seems a convenient way.

Don't use ``load'', which looks like a function to load variables saved by Scilab using ``save'' that produces binary data files.

Take one of my data files as example, the data file consists of four columns: time, ax, ay, and az1

1.00000 0.139641 -0.139664 0.980796
1.03125 0.125245 -0.152101 0.975367
1.06250 0.143240 -0.153878 0.966317
1.09375 0.141441 -0.157431 0.964507
1.12500 0.127045 -0.139664 0.964507
1.15625 0.134243 -0.157431 0.968127
1.18750 0.137842 -0.148548 0.982606
1.21875 0.128844 -0.148548 0.975367
1.25000 0.127045 -0.144994 0.984416
1.28125 0.146839 -0.153878 0.971747
1.31250 0.150438 -0.148548 0.966317
.
.
.

Then use ``read'' to get the overall data as a matrix.

data = read('dataFileName',-1,4); // -1 means we don't know the data number of row
data_time = data(:,1); // assign the 1st column to the 1st variable
data_accx = data(:,2); // assign the 2nd column to the 2nd variable
data_accy = data(:,3);
data_accz = data(:,4);

For the convenience of future using or modification, we can save the above script as the fooFileName.sce file. Next time when we need the script, just use ``chdir'' to change the working directory where the sce file exists, then use ``exec fooFileName.sce'' to execute the script.

Thursday, March 01, 2007

[SW] Scilab

Scilab Homepage

I downloaded it several months ago, but haven't spend time to understand it yet.

These days I encountered some problem in my Kalman Filter C code. For 2 by 2 matrix, everything is fine. When I rewrote the program for 3 by 3 case, however, it went overflow with causes I cannot figure out... Orz

Therefore, I think it is necessary to write the code in something like Matlab. Open and free software occurred to me, and it is the downloaded Scilab.

Hope I can get familiar with it as soon as possible, or my research progress will be delayed more. :-p


Here is a homepage including informations and tutorial materials about Scilab:
http://www.engineering.usu.edu/cee/faculty/gurro/Scilab.html


Another basic tutorial: (added at 2009/05/22)
Master Scilab! by Finn Haugen