Answered

End of function slow - Matlab Profiler

Pretty sure you'll find it's the overhead for the function call

End of function slow - Matlab Profiler

Pretty sure you'll find it's the overhead for the function call

7 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...

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...

7 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...

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...

7 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))

Argmin with several minimums

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

7 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...

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...

7 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...

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...

7 years ago | 0

| accepted

Answered

Simple solution to a simple problem

Try 1./(1 + 9*x.^2) i.e. a '.' before the division

Simple solution to a simple problem

Try 1./(1 + 9*x.^2) i.e. a '.' before the division

7 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...

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...

7 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...

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...

7 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...

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...

7 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...

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...

7 years ago | 0

| accepted

Answered

finding turning points of a dataset

Why don't you look for local maxima of curvature? This way you don't have to define any subjective tolerances. You may need to s...

finding turning points of a dataset

Why don't you look for local maxima of curvature? This way you don't have to define any subjective tolerances. You may need to s...

7 years ago | 1

Answered

MATLAB Project for Chemistry

How about simulating the Belousov-Zhabotinsky reaction in 2 dimensions? Start by watching some YouTube videos and work from ther...

MATLAB Project for Chemistry

How about simulating the Belousov-Zhabotinsky reaction in 2 dimensions? Start by watching some YouTube videos and work from ther...

7 years ago | 0

Answered

How to run multiple different scripts in parallel ?

One way to do it matlabpool open local 4 spmd switch labindex case 1 script1 ...

How to run multiple different scripts in parallel ?

One way to do it matlabpool open local 4 spmd switch labindex case 1 script1 ...

7 years ago | 0

Answered

Row by column multiplication

There is a built in way to do it quickly if you use sparse multiplication. Essentially, you construct the block diagonal matrix ...

Row by column multiplication

There is a built in way to do it quickly if you use sparse multiplication. Essentially, you construct the block diagonal matrix ...

7 years ago | 0

Solved

Determine if input is odd

Given the input n, return true if n is odd or false if n is even.

7 years ago

Answered

How to calculate eigen values and eigen vectors of a square matrix without using eig() function?

_"Please tell me algoritm for this."_ * Power Method * Inverse/Shifted Inverse Power Method * QR Algorithm * Jacobi Algori...

How to calculate eigen values and eigen vectors of a square matrix without using eig() function?

_"Please tell me algoritm for this."_ * Power Method * Inverse/Shifted Inverse Power Method * QR Algorithm * Jacobi Algori...

8 years ago | 0

Answered

Proper implementation and use of fmincon

I presume [1 2 3 4] and [6 7 8] are sets of possible values for x1 and x2. If your problem is only small, then you can use brute...

Proper implementation and use of fmincon

I presume [1 2 3 4] and [6 7 8] are sets of possible values for x1 and x2. If your problem is only small, then you can use brute...

8 years ago | 0

Answered

Find Joint Angle for Animation

You are taking the dot products of the wrong vectors! You need to take the vectors emanating from M2. The following should do th...

Find Joint Angle for Animation

You are taking the dot products of the wrong vectors! You need to take the vectors emanating from M2. The following should do th...

8 years ago | 0

| accepted

Solved

Tic Tac Toe FTW

Given a tic tac toe board: * 1 represents X * 0 represents empty. * -1 represents O It is X's move. If there is an imme...

8 years ago

Answered

Performing Gauss Elimination with MatLab

The function you want is LU [L, U] = lu(K); The upper triangular matrix resulting from Gaussian elimination with partial...

Performing Gauss Elimination with MatLab

The function you want is LU [L, U] = lu(K); The upper triangular matrix resulting from Gaussian elimination with partial...

8 years ago | 0

Solved

The Hitchhiker's Guide to MATLAB

Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

8 years ago

Solved

Weighted average

Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

8 years ago

Solved

Pizza!

Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

8 years ago

Solved

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

8 years ago

Solved

Eliminate unnecessary polygon vertices

Suppose you have an n-point polygon represented as an n-by-2 matrix of polygon vertices, P. Assume that the polygon is closed; t...

8 years ago

Answered

Attempted to access Pe(7); index must be a positive integer or logical.

Your problem is that |q| and hence |m| are floating point numbers, not integers. in this case the problem is that m = 0.6 /...

Attempted to access Pe(7); index must be a positive integer or logical.

Your problem is that |q| and hence |m| are floating point numbers, not integers. in this case the problem is that m = 0.6 /...

8 years ago | 0

Answered

Solving an implicit function, fsolve vs. fzero

How about doing a fixed number of Newton steps for each problem? (not necessarily doing a convergence check) For example: ...

Solving an implicit function, fsolve vs. fzero

How about doing a fixed number of Newton steps for each problem? (not necessarily doing a convergence check) For example: ...

8 years ago | 0

Answered

How do I find common volume of spheres?

Here's how I'd do it (if I was in a hurry). First pretend all the spheres are cubes, and find their intersection. inx = [...

How do I find common volume of spheres?

Here's how I'd do it (if I was in a hurry). First pretend all the spheres are cubes, and find their intersection. inx = [...

8 years ago | 0