When running long code streams, waiting in front of the computer watching the program run can be excruciating. Sometimes I find myself doing this if I do not know how long the code will run, or if there will be errors returned. (I also sit in front of the computer because I enjoy watching cat gifs and the old school de-fragmentation screens, so who knows…) But you don’t have to! Go out and accomplish something else while your computer chugs away. With the useful command sendmail, we can send messages to our email or phone with some simple commands. Through this post, I’ll share some sample .m files that we commonly use to notify ourselves of code completion or errors.
In lieu of the holiday season, Matlab Geeks is going to take a small break from writing Matlab code. Instead, we’d like to share this great article on the best practices for scientific computing. Increasingly, scientists are writing computer programs to perform their research. However, most scientists only have rudimentary training in computer programming and do not know how to create efficient, reliable, and maintainable code. This brief article lists ten recommendations that can help increase the productivity of scientists and engineers. We have summarized the main points of the paper in this article. We try to use these recommendations ourselves and believe the dissemination of this knowledge will help the scientific computing community become more productive.
A common problem in Matlab and every other programming language that uses floating point numbers is that calculations involving floats often do not yield the expected answers because of rounding, which can have undesirable effects on control statements. The immediate question is how to handle these rounding errors so that intuitively correct statements are recognized as true by a program. We would like to accomplish this while still retaining as much relevant information in the numbers as possible, thereby allowing the detection of minute differences that are not artifacts of rounding. In this post, some common errors in floating point comparisons will be discussed, as well as methods of handling these errors.
After introducing floating point numbers and sharing a function to convert a floating point number to its binary representation in the first two posts of this series, I would like to provide a function that converts a binary string to a floating point number. In addition. I will convert between different types of binary representations and discuss their merits.
Symbolic expressions can allow for the evaluation of equations as shown in a previous post on symbolics. Symbolics can further be used to solve equations that vary with time or with respect to one another. Calculating this change, either as a derivative or integral, can be done implicitly using the functions ‘sym’,’diff’, and ‘int’.