Loren on the Art of MATLAB

Results for: Numerical Accuracy

Arithmetic Associativity – Not So Fast 7

Posted by Loren Shure,

Arithmetic is associative, right? Well, in the world of paper and pencil, where you can often do calculations exactly, that can be true. However, in the computing world, where real numbers can't always be represented exactly because of working with finite precision datatypes, it turns out that you can't depend on the arithmetic to behave the way you were taught in grade school.... read more >>

Seeking Symmetry in MATLAB 7

Posted by Loren Shure,

Sometimes I need to construct a matrix with certain symmetries. There are a bunch of tools in MATLAB that are well suited for such tasks. In today's post, I will mention the ones I use most often.... read more >>

Double Integration in MATLAB – Understanding Tolerances 4

Posted by Loren Shure,

In today's post, I am joined by Mike Hosea, a developer who occasionally works on integration routines for MATLAB. In recent releases, we added new integration routines, including integral2 for double integrals. Today we'll talk about some nuances in using this routine and adjusting the absolute and relative tolerances.... read more >>

How Many Digits to Write? 23

Posted by Loren Shure,

How Many Digits to Write?  Recently, my colleague Rob Comer and I were talking about how to write out a number, in decimal, so that if it were read back into MATLAB, would retain its full precision. The... read more >>

By All Means 2

Posted by Loren Shure,

By All Means  Ever find yourself wanting to get some sense of some data, but not sure the arithmetic mean is what you want? You might also consider the geometric mean (geomean from Statistics Toolbox). In the image processing world, I understand... read more >>

How to Check for Existence of Solution to Matrix Equations 6

Posted by Loren Shure,

How to Check for Existence of Solution to Matrix Equations  There was a great question on the newsgroup this past week asking how to determine if a system of equations had a solution. The poster wasn't (at least yet) concerned with what... read more >>

Comparing Single-threaded vs. Multithreaded Floating Point Calculations 13

Posted by Loren Shure,

Comparing Single-threaded vs. Multithreaded Floating Point Calculations  There continue to be a flurry of queries suggesting that MATLAB has bugs when it comes to certain operations like addition with more than values. Sometimes what prompts this is a user noticing... read more >>

Rounding Results 15

Posted by Loren Shure,

Rounding Results  There are frequent questions on the MATLAB newsgroup about rounding results to a certain number of decimal places. MATLAB itself doesn't provide this functionality explicitly, though it is easy to accomplish. ... read more >>

Evens and Odds 3

Posted by Loren Shure,

Evens and Odds  There are so many functions in MATLAB that sometimes users think that if they can't find the function they are thinking of, it's because they don't know the name. Sometimes that's true,... read more >>

HELP – I Got the Wrong Answer for My Optimization! 16

Posted by Loren Shure,

HELP – I Got the Wrong Answer for My Optimization!  How often I have heard this!?! It turns out there are a bunch of reasons why you might not get the answer you expect when performing an optimization task. These possibilities... read more >>

These postings are the author's and don't necessarily represent the opinions of MathWorks.