draw ellipse and ellipsoid in MATLAB

Ellipse article on Wikipedia had a simple JavaScript code to draw ellipses. It uses the parametric form: x(theta) = a0 + ax*sin(theta) + bx*cos(theta) y(theta) = b0 + ay*sin(theta) + by*cos(theta) where (a0,b0) is the center of the ellipse (ax,ay) vector representing the major axis (bx,by) vector representing the minor axis I translated the code … Read more

Return Unique Element with a Tolerance

With R2015a, this question finally has a simple answer (see my other answer to this question for details). For releases prior to R2015a, there is such a built-in (undocumented) function: _mergesimpts. A safe guess at the composition of the name is “merge similar points”. The function is called with the following syntax: xMerged = builtin(‘_mergesimpts’,x,tol,[type]) … Read more

How to do an animated plot in matlab

If what you want is for the plot to “grow” point by point: the easiest way is to create an empty plot and then update its XData and YData properties at each iteration: h = plot(NaN,NaN); %// initiallize plot. Get a handle to graphic object axis([min(DATASET1) max(DATASET1) min(DATASET2) max(DATASET2)]); %// freeze axes %// to their … Read more

Fastest Matlab file reading?

Problem statement This is a common struggle, and there is nothing like a test to answer. Here are my assumptions: A well formatted ASCII file, containing two columns of numbers. No headers, no inconsistent lines etc. The method must scale to reading files that are too large to be contained in memory, (although my patience … Read more