MATLAB to Python?

Peter Otten __peter__ at web.de
Wed Nov 17 03:38:49 EST 2010


MATLABdude wrote:

> Can you, please, try to help me with Python? I try to convert a MATLAB
> program to Python.
> 
> Here are the MATLAB codes:
> http://pastebin.com/eJetYizv
> http://pastebin.com/0eXTVfyN
> 
> Here is my Python code:
> http://pastebin.com/jCPdLHx7

That is too much code for me, in a problem domain I'm not familiar with.

> What is wrong with my Python code? The program doesn't produce quite
> the same lambdas as the MATLAB program does. My code probably has lots
> of errors because I'm just learning the basics about Python.

If no-one fixes it for you I suggest that you break the code in smaller 
functions (at most ten lines) that you can test separately. That should make 
it easier to spot the misbehaving parts of your calculation.
If you come back then with one of these, the matlab equivalent, sample input 
and expected output a significantly larger number of people can and may be 
willing to help.

Peter



More information about the Python-list mailing list