To MatLab, or not to MatLab

It seems that the kids coming out of engineering schools nowadays are pretty ignorant of Fortran, but fairly well versed in MatLab. We wrote most of our codes in Fortran with a few scripts in Perl. For programs that are CPU-bound and require raw speed (such as simulators), I think we’ll stick with Fortran for now–it’s the fastest language for such software.

For I/O-bound programs (such as postprocessors), it may make more sense to use MatLab–especially because it has such a complete set of analysis tools. I’m faced with making some significant changes to Crunch and was wondering if I should use MatLab instead.

What do you think?

Marshall

I will strongly recommend MatLab. As you pointed out, it has a wide range of sophisticated analysis tools. Other advantages are:

1.Terse and intutive commands
2. Ideally suied for arrays
3. No need for explicitly allocating memory
4. Ease of understanding/ modifying scripts
5. Acess to built-in display (plotting) utilities

Disadvantage of course is slow speed compared to the speed offered by codes like Fortran. I am also not sure if it can efficiently handle very large arrays usually required for our post-processing needs.

If large memory handling is not a serious problem, I see no reason why we should not go for MatLab. Any feedback?

In post-processing my data in Crunch, I’ve often come across memory issues so I’m not sure that writing it in Matlab will improve things.

Also, in order to get people to use our codes, having a DOS executable is preferable than requiring people to get a Matlab license (although there is that open source version). And, if we’re running a bunch of simulations on our grid (i.e. Condor) we can be license limited.

Hey All,

Regarding the ignorance of compiled code, we academics have reacted to the different learning requirements of today’s students. We found that students need quicker feedback. Also, from a teaching perspective, I’d much rather have the students work on understanding the physics and mathematics rather than how to compile a FORTRAN or heavens be a C code ;-) So, at NAU and at many other schools, undergraduates are taught how to program/script using MATLAB so that they can more quickly get to the physics, create plots and focus more on understanding the information. Leave compiled code fro Grad school…

Regarding using MATLAB with large matrices and such, I’ve found that it can be readily used to handle the large matrices, that’s what its designed for afterall. We used it to rip through the UAE data for instance and create plots and animations. We even scripted it together with FIELDVIEW FVX scripts to create an instrument panel of CFD derived pressures and forces vs experiment and overlayed with CFD visualizations. So my expereince and student’s experience is very positive. Eventually though, they will need to learn to program and compile using FORTRAN.

Also note that some people will have issues with having to buy MATLAB. The answer there is that most of the functionalies in MATLAB .m files can be executed using the gnu tool “octave” which also makes use of gnuplot for the ploting. octave comes with the cygwin distro so it can be easily used on windoze. Dunno about Mac’s though… you can always compile from source ;-)

My 20 cents worth…

cheers,
e.

There is a compiler available for MatLab that allows you to distribute the code to non-MatLab owners.

Marshall

At Windward we have used Matlab scripts for several years to run and post-process simulations. It was relatively easy to write programs that would run and process large batches of simulations. I found these more productive and easier to write and maintain than other methods we had tried. We used Crunch for rainflow cycle counting and azimuth averaging, but Matlab for everything else.

The signal processing tools that are available in Matlab are very powerful and easy to use. Anyone involved in control system design is probably already using Matlab, so they are likely to appreciate a switch to Matlab for post-processing.

I recommend that you make the switch.

Marwan Bikdash of North Carolina A&T State University was unfamiliar with our forum, so he e-mailed his response:

I am a typical kid just came out of Engineering school :slight_smile: and I will definitely appreciate the idea of writting post-processing codes in Matlab.
It will take much less time for kids like me to understand what the codes are doing… as I do not know Fortran at all >.< .

Hi,

Currently, MCrunch (my MatLab-based postprocessor designed to replace Crunch, GPP, and GenStats) can do the following:
Process files of various lengths
Add scales and offsets to input data
Add calculated channels
Plot time series with user-defined layout of subplots
Calculate statistics
Generate summary statistics as Crunch did
Tabulate extreme events
Generate and plot probability density functions
Do rainflow analysis, bin by range and/or mean, calculate DELs
Features on my to-do list:
Load roses
PSDs
Limit input and processing to selected channels
Low-pass, high-pass, and band-pass filtering
Moving averages
Peak and valley listing
Statistical extrapolation
Decimation
Output modified input including calculated channels
Tab-delimited option for output
Interpolation
Binning
Crosstalk removal
Merge processed data with boilerplate loads document
Please tell me how you would like to see the above implemented. Post your requests for other features. Rate features for importance.

I’ve never had to generate a loads document, so it’s hard to guess what the industry needs. Your feedback will be greatly appreciated.

Marshall

Hi all,

I am currently working on my masters here in Germany. I am using your codes here but I really have problems, understanding the Fortran files. I just once skimmed over them to find how a moment is defined and it really was hard to understand. It would be so much easier to do this all in Matlab for me and all students I know. Frankly I do not now one engeneering student who can compile in fortran. But everybody here uses and knows Matlab.

Oktave would really be a great alternative, too.

Andreas

Thanks for the feedback.

MatLab is highly inefficient computationally. Processing takes probably an order of magnitude longer than it would for Fortran. Programs that are CPU bound will always need to use a compiled language. Fortran is the fastest language for scientific and engineering modeling. As long as MatLab is primarily an interpreted language, we’ll continue doing our simulations in Fortran (or C++).