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

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

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

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

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

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

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

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

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

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

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

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

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

7 years ago | 0

Answered

Problem using 'deal' for objective and gradient in comb. with 'DerivativeCheck'

An internal routine (in this case |finDiffEvalAndChkErr|) is calling your routine with only one output. For a regular function t...

Problem using 'deal' for objective and gradient in comb. with 'DerivativeCheck'

An internal routine (in this case |finDiffEvalAndChkErr|) is calling your routine with only one output. For a regular function t...

7 years ago | 0

| accepted

Answered

Minimizing the values in an underdetermined Matrix - minimize with constraints

*edit*: fixed mistake in call to |linprog| To perform L1 minimisation, you'll need access to an LP solver. If you have the op...

Minimizing the values in an underdetermined Matrix - minimize with constraints

*edit*: fixed mistake in call to |linprog| To perform L1 minimisation, you'll need access to an LP solver. If you have the op...

7 years ago | 0

| accepted

Answered

How to change selected data which would give me the line of best fit (R squared close to 1)?

For the first part x(logical(imag(x))) = nan; For the second, your data points are all over the show. Any two will fit a s...

How to change selected data which would give me the line of best fit (R squared close to 1)?

For the first part x(logical(imag(x))) = nan; For the second, your data points are all over the show. Any two will fit a s...

7 years ago | 0

| accepted

Answered

Initializing vs growing a structure

Let's say you wanted to create a 100x1 struct array with a field |A| that you know will store a 3x3 matrix struct('A', repm...

Initializing vs growing a structure

Let's say you wanted to create a 100x1 struct array with a field |A| that you know will store a 3x3 matrix struct('A', repm...

7 years ago | 0

Answered

Minimizing the values in an underdetermined Matrix - minimize with constraints

Assuming you want a minimal Euclidean norm solution, there's no built-in function, but I can offer you a two-line solution: ...

Minimizing the values in an underdetermined Matrix - minimize with constraints

Assuming you want a minimal Euclidean norm solution, there's no built-in function, but I can offer you a two-line solution: ...

7 years ago | 0

Answered

How to maximize this function: x1^2+x2^2+...+xn^2 ?

I assume you mean minimise rather than maximise, because unless you have |n| independent constraints, your problem is unbounded....

How to maximize this function: x1^2+x2^2+...+xn^2 ?

I assume you mean minimise rather than maximise, because unless you have |n| independent constraints, your problem is unbounded....

7 years ago | 0

Answered

Can linprog give an integer value of x's?

No there isn't. Integer linear programming is a different beast. Perhaps this one from the file exchange might help: <http://...

Can linprog give an integer value of x's?

No there isn't. Integer linear programming is a different beast. Perhaps this one from the file exchange might help: <http://...

7 years ago | 0

| accepted

Answered

How to output matlab ode dependent variable at same time step as T and Y?

By far the best way is to compute your dependent variable _afterwards_ with the |y| matrix that was computed by the ODE solver. ...

How to output matlab ode dependent variable at same time step as T and Y?

By far the best way is to compute your dependent variable _afterwards_ with the |y| matrix that was computed by the ODE solver. ...

7 years ago | 1

Answered

In a spmd statement ,How to call a function that contains another spmd statement.

It's because you're calling |spmd| within another |spmd| block (I'm not sure you can do this). Your initial |spmd| call will tak...

In a spmd statement ,How to call a function that contains another spmd statement.

It's because you're calling |spmd| within another |spmd| block (I'm not sure you can do this). Your initial |spmd| call will tak...

7 years ago | 0

Answered

how to construct an affinity matrix?

This might be helpful <http://www.mathworks.com/matlabcentral/fileexchange/26354-spectral-clustering-algorithms>

how to construct an affinity matrix?

This might be helpful <http://www.mathworks.com/matlabcentral/fileexchange/26354-spectral-clustering-algorithms>

7 years ago | 0

| accepted

Answered

using ode45 with input arrays

OK, I understand what you're asking now First make sure |theta|, |gamma|, and |velocity| are column vectors of the same lengt...

using ode45 with input arrays

OK, I understand what you're asking now First make sure |theta|, |gamma|, and |velocity| are column vectors of the same lengt...

7 years ago | 0