Matlab is, to the programmer with experience in almost any other language, a tremendous horror. The language is almost as cobbled together and inconsistent as PHP with the added bonus of being worked on almost exclusively by engineers instead of people who actually want to write programs (this coming from an engineering student here). That being said, if you have the mathematical chops to rearrange your problem into…
Python+Scipy+Matplotlib vs Matlab?
21–30 of 45 posts
Re: Python+Scipy+Matplotlib vs Matlab?
#22Matlab is, to the programmer with experience in almost any other language, a tremendous horror. The language is almost as cobbled together and inconsistent as PHP with the added bonus of being worked on almost exclusively by engineers instead of people who actually want to write programs (this coming from an engineering student here). That being said, if you have the mathematical chops to rearrange your problem into…
I don't agree Matlab is a horror - and I am a CS person, not an "engineer" as you say. It is an excellent domain-specific language. It might not be a good general-purpose language, but it was never intended to be that. True, some of the "bolt-on" parts of Matlab feel inconsistent, but the matrix/vector/tensor core is very elegant and powerful.
Unfortunately, in any real project I've ever done with Matlab you cannot survive just inside the matrix DSL and once you start touching the bolted-on bits you lose patience very quickly.
So, I suppose I agree, it's a nice DSL, but I'd also wager that the majority of people using it don't realize the limitations implicit there.
Re: Python+Scipy+Matplotlib vs Matlab?
#23Earlier quoted context omitted.
I don't agree Matlab is a horror - and I am a CS person, not an "engineer" as you say. It is an excellent domain-specific language. It might not be a good general-purpose language, but it was never intended to be that. True, some of the "bolt-on" parts of Matlab feel inconsistent, but the matrix/vector/tensor core is very elegant and powerful.
I would consider Matlab to be a DSL grown out of control. If you are working purely with matrix/vector/tensor math, as you say, you can be reasonably comfortable with the language as long as you remember to double-check the docs on nearly every function before you use it just in case there is some strange edge-case it handles awkwardly. Unfortunately, in any real project I've ever done with Matlab you cannot survive…
Or stupidly. I don't know if the following should qualify as an edge case generally, but it does in Matlab.
The controls lab in the aerospace department at the U of W had a wonderful inverted cart-pendulum device that a grad student was doing some seriously freaky non-linear control research on. We were tasked, as part of a lab, to write a controller in Matlab that would balance the pendulum and move the cart to a designated position. After trying for days to come up with a combination of gains to result in stable control, I decided to write an evolutionary algorithm to choose a controller.
It was dead simple. The genome was a list of gains. The code created generations of genomes and then ran them through the simulation. The tricky part (for me at that time) was finding the settling time (walk backwards from the end of the data, checking for values outside of the tolerance). Choose the winners, perturb, preserve best performers, and go around again. Doing all the steps by hand worked wonderfully.
When I ran the code, I got combinations of gains that resulted in massively unstable systems; systems that overshot off the chart as soon as physically possible given the hardware. What was going on?
It turns out, when I ran the simulation from the command line, Matlab graciously accepted my 5-second simulation time. However, when run from a script, Matlab ignores that parameter and runs the simulation until the output careers off the chart. Because I was looking for a minimum time with no overshoot, my algorithm was finding combinations of gains that overshot steeply enough to convince Matlab to stop simulating ASAP! It was bizarre. My secondary condition was minimum overshoot, so I got solutions that were exactly steep enough to cause the simulation to stop when the output hit the desired value!
A friend of mine stumbled on to a workable combination of gains. I used those.
Re: Python+Scipy+Matplotlib vs Matlab?
#24I'll also mention that SciPy is in use at some of the biggest companies in the world, and because of its stronger programming language base, it can be used for much larger problem sets than Matlab. Massive fluid dynamics computing projects, requiring clusters of machines, for example, is feasible (and being done) with SciPy. Likewise for geological data analysis. I don't know anything about parallelizing Matlab, but I'm guessing the possibilities are much greater with Python.
And, of course, Python skills are probably more transferable to other work.
I don't see how you could lose by trying SciPy. It's free, has a great community of incredibly smart people (it's the community with the highest ratio of PhDs to others that I've ever been a part of), and is fun to play with.
Re: Python+Scipy+Matplotlib vs Matlab?
#25If you're working for personal gain, you're probably better off with the Python+ solution because it's a) cheaper, and b) translates into knowledge that can be harnessed in other applications you write in Python. You're probably unlikely to write a real application in Matlab. If you're going to be doing work at a university, you may find reluctance from the persons you are working with as I did a few years back. The…
Re: Python+Scipy+Matplotlib vs Matlab?
#26Re: Python+Scipy+Matplotlib vs Matlab?
#27Re: Python+Scipy+Matplotlib vs Matlab?
#28Most universities have studen license servers for Matlab afaik. And, Matlab is really really, annoyingly powerful. You've got almost anything to try your ideas, implement an academic paper. But, it is slow (execution time). Prototype with Matlab, implement with C++. That's what I usually prefer. I am not a Python expert, just learning it. but I think it will be slower than C, and less powerful than Matlab, from my pe…
Re: Python+Scipy+Matplotlib vs Matlab?
#29I find that matlab is a great program to try out new ideas and algorithms when you are just starting out. The plotting library is also very easy to use and there are many helpful built in functions for matrix, linear algebra manipulations. However the language itself is a horror to code in, its based on fortran. I still really hate the 1 based array indexing after using it for years.