Matlab Translations -- Was: filtering images in the fourier domain [message #37147] |
Mon, 17 November 2003 16:47 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
M. Katz writes:
> I know this is a topic for a separate thread, but I'm interested to
> know more about the Matlab vs. IDL differences. I always figured their
> similarities made things a toss-up for small projects--but objects,
> and pointers, and object graphics give IDL a big advantage in
> important ways for more complex projects.
>
> I'm in an IDL minority among colleagues who are all trained on free
> Matlab academic licenses. David, as someone actually making
> translations, what can you say about concrete differeces and ease of
> solution between the two systems.
This is the first day of my first Matlab translation. My
general impression is that I wish I had paid WAY more
attention in those linear algebra classes! :-)
What I am working on is a small application that comes
with it's own GUI for importing values into some equations
that need to be solved in an iterative way. I have about
30-40 m files, I guess. About 10 of them concern the
algorithm, and the rest appear to be programs that set
up the GUI.
The most obvious difference is that Matlab array indexing
starts at 1. This causes a lot of errors in my loops. And
I see LOTS of loops in the Matlab code. I usually
start by doing a direct (you might say "loopy") translation
to be sure I'm getting the code correct. Then I usually
say "Wait a minute. Can't those 10 lines be replaced with
this one?". The answer is inevitably "yes".
I run into lots of Matlab "functions" that I don't know.
Matlab has a *wonderful* web site that explains what these
things do. That is very helpful.
In this application I'm seeing a lot of matrix algebra
that I have mostly forgotten. There are a lot of diagonals
being calculated, then a matrix being multiplied with something
else. I guess I don't do much math in IDL, or something, but
it has been a long time since I thought much about kind of
thing. The Matlab folks like to shift a power spectrum by
multiplying every other row and column by -1. I think a
simple SHIFT does the job very nicely, thank you!
My main problem at the moment is that I have a hard time
seeing how these m files are put together. I don't really
see the "thread" of the application yet. There are a lot
of "global" variables that are important to me, but I have
not been able to see where these get their default or
starting values. I see the main m module that gets
everything started, but I don't see how initial
variable values are assigned. I don't see any
"optional" parameters in the function definitions.
(This could all be a function of the person writing
the code. Lord knows I've seen strange IDL programs
in my day!)
I guess my general impression is that Matlab looks
WAY more mathematically sophisticated than IDL, but
IDL looks WAY easier to program. I guess it was ever
thus. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|