The MATLAB R2018b release notes report a number of performance improvements, including faster startup and faster calls to built-in functions. I pick out here a few other highlights from the release (excluding the toolboxes) that are of interest from the numerical analysis point of view.
yline functions add vertical or horizontal lines to a plot—something that I have needed from time to time and have previously had to produce with a
line or a
plot command, together with
hold on. For example,
xline(pi) plots a vertical line at
x = pi.
stackedplot function is mainly of interest for plotting multiple variables from a table in a single plot, but it can also plot the columns of a matrix. In this example,
A is the symmetric eigenvector matrix for the second difference matrix:
A = gallery('orthog',10,1); stackedplot(A);
The resulting plot clearly shows that the number of sign changes increases with the column index.
String arrays, introduced in R2016b, are now supported throughout MATLAB. In the previous example I could have typed
A = gallery("orthog",10,1).
A new option
'all' to the functions
sum (and a few others) makes them operate on all the dimensions of the array. For example:
>> A = pascal(3) A = 1 1 1 1 2 3 1 3 6 >> max(A,,'all') ans = 6 >> [prod(A,'all'), sum(A,'all')] ans = 108 19
The empty second argument in the
max call is needed because
max(x,y) is also a supported usage. This is a useful addition. I have often written
norm(A(:),inf) to avoid
max(max(abs(A))) (which does not work for arrays with more than two dimensions), but now I can write
max(abs(A),,'all') without incurring the overhead of forming
cospi plot the sine and cosine functions at the specified multiple of . Thus
sinpi(x) is the same as
sin(pi*x) except that it does not explicitly compute
pi*x and so returns exact answers for integer arguments:
>> [sin(pi) sinpi(1)] ans = 1.2246e-16 0