Community Profile

photo

Richard Brown


Massey University

202 total contributions since 2007

Maths Lecturer at Massey University. Working on high performance computing and modelling.
Professional Interests: numerical analysis, modelling, computer vision, mathematical biology

Contact

Richard Brown's Badges

Contributions in
View by

Submitted


fitellipse.m
Fit ellipses to 2D points using linear or nonlinear least squares

9 months ago | 131 downloads |

Thumbnail

Submitted


nearestneighbour.m
Computes nearest neighbour(s) by Euclidean distance

9 months ago | 63 downloads |

Thumbnail

Answered
How to create a sparse matrix with such specifications?
*edit* This version is wrong, but leaving so comment below makes sense density = 0.01; % For example m = 10000; n = 1000...

3 years ago | 0

Answered
count groups of elements and distances between them
A = [6 6 6 4 4 4 4 4 6 5 5 7 7 7 8 9 8 7 0 0 0 0]; x = diff([find(diff([0 ismember(A, [0 6]) 0]))]); L = x(1:2:end); ...

3 years ago | 2

Answered
Positive Semi-definite Matrix Problem
You're just going to have to live with it. Your matrix is PSD to double precision. If you look at the magnitude of the "zero" ei...

3 years ago | 1

Answered
vectorizing calculation of eigen values of a large multi-dimensional array
You'll get a bit of a performance boost simply by looping over linear indices rather than nesting (this is more than twice as fa...

3 years ago | 0

Answered
Reduced row echelon form technique
It'll be a difference between yours and MATLAB's choice of tolerance. Your matrix should be rank 2, however I notice that MATLAB...

3 years ago | 0

| accepted

Answered
Evaluation of matrix element of a linear differential matrix equation by constrained least square fitting
Assuming you have multiple |X| and |X'| vectors that you're trying to fit your matrix to, your problem can be posed as a constra...

3 years ago | 0

| accepted

Answered
displaying indexed values correctly
Similar to what you asked before, I think what you want is to find the |Vb| element that is closest to half of |Vb_ev|, and then...

3 years ago | 0

| accepted

Answered
finding closest values in array
If I understand correctly, you want to find the |pH| value in your array closest to 4.756, and pull this value out, together wit...

3 years ago | 4

| accepted

Answered
How can I create sparse symmetric positive definite linear system?
|sprandsym| is what you want. m = 50; density = 2/m; % for example rc = 0.1; % Reciprocal condition number A = spr...

3 years ago | 1

| accepted

Answered
Sign differences in QR decomposition
It's only unique up to the signs of the rows of |R|. If you want to enforce positive diagonals of |R|, and thereby get a unique ...

3 years ago | 1

| accepted

Answered
Output argument "Clus_Area" (and maybe others) not assigned during call to
Check that the line if AR > 0 is doing what you intend. This will only evaluate if all entries of |AR| are positive. T...

3 years ago | 0

Answered
How to use variable value as an input to the function?
You can very probably get away with just passing |template1| and |template2| themselves (not trying to create references to them...

3 years ago | 0

Answered
Why I'm keep getting these errors? Please help!
The error message says it all. You're only computing one derivative in |my_function|. You need to define |ys(1)| and |ys(2)|...

3 years ago | 1

Answered
How do I efficiently calculate a scalar distance with 3d geometry?
You should use |hypot|. It also has better numerical stability. *edit* sorry, you're in 3D. That obviously won't work. You c...

3 years ago | 0

Answered
Generating a particular sequnce of numbers
Also comparable, but not (quite) faster n = 1:(d*(d+1)/2); a = ceil(0.5*(-1 + sqrt(1 + 8*n))); out = a.*(a + 1)/2 - n...

3 years ago | 2

Answered
Generating a particular sequnce of numbers
Even faster: k = 1; n = d*(d+1)/2; out = zeros(n, 1); for i = 1:d for j = i:-1:1 out(k) = j;...

3 years ago | 2

Answered
please help with logical operators
replace all instances of |lenght| with |length|

3 years ago | 0

Answered
End of function slow - Matlab Profiler
Pretty sure you'll find it's the overhead for the function call

3 years ago | 0

| accepted

Answered
Fit and Plot Gaussian Function
Sure, rather than trying to fit a distribution (which is not what you want), just fit the Gaussian itself. Generate some nois...

3 years ago | 0

Answered
Surface area from a z-matrix
OK, well how about splitting each quadrilateral into two triangles, and just summing up the areas? I'm sorry there's no way I ca...

3 years ago | 0

| accepted

Answered
Argmin with several minimums
It doesn't feel very satisfactory, but this will do the trick I = find(A == min(A))

3 years ago | 0

Answered
Projecting Points to a new Basis
I'm not sure what your question is asking because you're missing a symbol off your question. But I think you mean if n is not eq...

3 years ago | 0

Answered
How can I use "symbfact" to speed up several consecutive Cholesky factorizations?
You can't (unless something has changed recently). When I had to do this, I ended up working with the C code in CSparse directly...

3 years ago | 0

| accepted

Answered
Simple solution to a simple problem
Try 1./(1 + 9*x.^2) i.e. a '.' before the division

3 years ago | 0

Answered
Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)
It works perfectly x = [5.8808 6.5137 7.1828 7.8953]; y = [31.2472 33.9977 36.7661 39.3567]; pp = pchip(x...

3 years ago | 0

| accepted

Answered
Sparse and nonspare QR
Sorry to take a while, busy week. Neither are wrong. You'll notice that the only difference in the outputs is that the sparse ve...

3 years ago | 0

| accepted

Answered
Sparse and nonspare QR
On my system they match (up to the signs of the rows, as you'd expect). m = 20; n = 10; X = sprand(m,n,0.3); Rs...

3 years ago | 0

Answered
How to calculate expm of a badly scaled matrix?
You might this Cleve's corner instructive <http://blogs.mathworks.com/cleve/2012/07/23/a-balancing-act-for-the-matrix-exponenti...

3 years ago | 0

| accepted

Load more