public marks

PUBLIC MARKS with tag matlab

August 2007

Python instead of Matlab for plotting?

by pvergain
A few years ago I «fell in love» with Python , which is a dynamically typed interactive, object oriented scripting language. With a few extensions I found it very suitable for efficient visualization and problem solving in Scientific computing. So can it replace Matlab? For me its pretty close! For you? It depends on your needs, but have a look! Why I use Python * Python is a small, high level scripting language that sits on top of a efficient C library. Because of this, Python code is compact, and the resulting code can run at a speed close to C if the computationally intensive parts are done via library calls. * Short learning curve - I was almost instantly productive. * Python can be used interactively (like matlab), and documentation for most functions can be accessed via a built in help facility. * It is free (also in this regard) * The syntax invites you to write clean code. No ;'s at the end of lines, the block structure is described by indentation instead of Begin-End or {..}. Through the Numeric/numarray modules one gets powerful array syntax - inspired by languages such as Fortran 90, Matlab, Octave, Yorick etc. Python itself has also borrowed features from e.g. Lisp, with its interactivity and built in support for list manipulation. * Python has many other useful modules built in, one may for instance write a web server in just a few lines of code or work transparently with gzipped files (handy for analyzing large ascii data files) * Linking in and reusing Fortran subroutines is very easy using e.g. f2py mentioned below, or the Pyfort module found on www.python.org. Integration with C is of course even tighter since the most popular python is written in C. (yes. there is a java python...) * It is possible to work in single precision, which is sufficient for most scientific purposes. This makes it easier to work with large datasets/arrays using only half the memory compared to e.g. matlab. As my basic setup I use Python with the following extensions: Numpy: a.k.a. Numeric python, contain the advanced array syntax, as well as powerful and commonly used functions that can be applied to the multi dimensional arrays. Pygist: Gist is a very fast graphics library for 2D and 3D plots written directly for X11, but also ported to Mac and Windows. Gist is a part of the Yorick language. Pygist contain the Python bindings, read about it here. A recent version of Pygist can be found here. Pygist is currently also a part of a distribution of Python packages called Scipy, that can be found here. f2py: Makes connecting Fortran subroutines a breeze! Also a part of Scipy. A complete example: wrap this subroutine in a Python function returning "dist": [avle@tindved test]$ cat r1.f90 subroutine r1(x,y,n,dist) real x(n),y(n) !f2py intent(out) dist xl=0.0 ; yl=0.0 ; vp=0.0 do i=1,n xl=xl + x(i)**2 ; yl=yl + y(i)**2 vp=vp + x(i)*y(i) end do if(vp>=0.0)then dist = acos(sqrt(vp/(xl*yl))) else dist = 4*atan(1.0)-acos(sqrt(-vp/(xl*yl))) end if end subroutine r1 [avle@tindved test]$ ls r1.f90 [avle@tindved test]$ f2py -c -m r1 --fcompiler=g95 r1.f90 ..lots of output... [avle@tindved test]$ ls r1.f90 r1.so* [avle@tindved test]$ python2 Python 2.2.3 (#1, Feb 15 2005, 02:41:06) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-49)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import Numeric as nx, r1 >>> a=nx.array((2.3,2.2)) ; b=nx.array((3.2,2.1)) >>> r1.r1(a,b) 1.2827057838439941 >>>

April 2007

March 2007

February 2007

October 2006

September 2006

Dynamic Plot on Python

by YukuanBlog
之前介紹 Python 在複雜網路模擬實驗的應用時,曾提到用 Matplotlib 來繪製該實驗的圖表。其模仿 Matlab 的繪圖功能,用起來方便,所繪製的圖也在水準之上。有圖有真相,這就秀秀用 Matplotlib 為該實驗繪製的兩張圖表:

NumPy for Matlab Users - SciPy.org

by YukuanMark
MATLAB® and NumPy/SciPy have a lot in common. But there are many differences. NumPy and SciPy were created to do numerical and scientific computing in the most natural way with Python, not to be MATLAB® clones. This page is intended to be a place to col

August 2006

July 2006

June 2006

May 2006

Use php to start matlab script

by ponsfrilus
set data in PHP and start matlab script - run matlab script - read data from matlab script and redirect to php page - display result in php

PUBLIC TAGS related to tag matlab

algorithms +   axis +   blog +   bss +   c +   c++ +   club +   code +   comparison +   computing +   dev +   dsp +   EEG +   freeware +   function +   functions +   gm +   halftoning +   ica +   image_processing +   java +   math +   mathematics +   matrix +   midi +   numerical +   octave +   perl +   physics +   ponsfrilus +   programmer +   programming +   project +   python +   random +   ruby +   samples +   scheme +   science +   scientific +   script +   Searching +   server +   shell +   software +   sorting +   street +   synthesizer +   toolbox +   video +  

Active users

pvergain
last mark : 11/08/2007 20:30

zoofusa
last mark : 07/04/2007 21:42

lefty
last mark : 16/03/2007 14:45

wasteland93
last mark : 07/03/2007 07:38

Guillom
last mark : 05/02/2007 09:36

redivider
last mark : 19/10/2006 02:05

YukuanBlog
last mark : 26/05/2007 06:58

YukuanMark
last mark : 19/09/2006 00:06

ponsfrilus
last mark : 02/08/2006 15:26

topcool
last mark : 01/07/2006 08:25