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

meer dan 10 jaar 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...

meer dan 10 jaar 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...

meer dan 10 jaar ago | 3

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

meer dan 10 jaar 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....

meer dan 10 jaar 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://...

meer dan 10 jaar 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. ...

meer dan 10 jaar 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...

meer dan 10 jaar 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>

meer dan 10 jaar 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...

meer dan 10 jaar ago | 0

Answered

integration files

Mapping toolbox? <http://www.mathworks.com/products/mapping/>

integration files

Mapping toolbox? <http://www.mathworks.com/products/mapping/>

bijna 11 jaar ago | 0

Answered

reversible matrix operation

Your Laplacian matrix is not full rank. Because your system is consistent, you have multiple solutions, and you're just getting ...

reversible matrix operation

Your Laplacian matrix is not full rank. Because your system is consistent, you have multiple solutions, and you're just getting ...

bijna 11 jaar ago | 0

Answered

reversible matrix operation

Your code doesn't run for me -- first, I don't have a function |avg| - did you mean to use |mean|? Second, if I replace all ...

reversible matrix operation

Your code doesn't run for me -- first, I don't have a function |avg| - did you mean to use |mean|? Second, if I replace all ...

bijna 11 jaar ago | 0

Answered

if statement for range of array values

To check I've understood correctly, you only want to do something if the current and two preceding |x| values are all less than ...

if statement for range of array values

To check I've understood correctly, you only want to do something if the current and two preceding |x| values are all less than ...

bijna 11 jaar ago | 0

Answered

Matrix fill-in when solving sparse linear systems

Firstly, is there any reason to believe that |x| should be sparse? Just because your matrix |A = C*C'| and your right hand sides...

Matrix fill-in when solving sparse linear systems

Firstly, is there any reason to believe that |x| should be sparse? Just because your matrix |A = C*C'| and your right hand sides...

bijna 11 jaar ago | 0

| accepted

Answered

Runge-Kutta method related

Why are you bothering to use |ode45| at all? Your solution for any |t >= ti| is just y = y0 + (t - ti) * (g*n-0.5*(u^2+v...

Runge-Kutta method related

Why are you bothering to use |ode45| at all? Your solution for any |t >= ti| is just y = y0 + (t - ti) * (g*n-0.5*(u^2+v...

bijna 11 jaar ago | 1

| accepted

Answered

Inserting zero rows and columns into matrix efficiently

Perhaps I'm misunderstanding, but your example can be generated from the following M = zeros(numel(pointer_master)); M(p...

Inserting zero rows and columns into matrix efficiently

Perhaps I'm misunderstanding, but your example can be generated from the following M = zeros(numel(pointer_master)); M(p...

bijna 11 jaar ago | 1

Answered

Fixed point (matematice)

|xold| never gets updated, so |xnew| gets set to the same value every iteration, and the loop never ends ...

Fixed point (matematice)

|xold| never gets updated, so |xnew| gets set to the same value every iteration, and the loop never ends ...

bijna 11 jaar ago | 0

| accepted

Answered

ode45

Yes, certainly possible. The basic approach would be to turn it into a system of first order odes of twice the dimension as foll...

ode45

Yes, certainly possible. The basic approach would be to turn it into a system of first order odes of twice the dimension as foll...

bijna 11 jaar ago | 1

| accepted

Answered

Caught in loop

Your code works fine. If you remove the |disp| statement (which is causing it to slow down heaps), you'll find that it runs comp...

Caught in loop

Your code works fine. If you remove the |disp| statement (which is causing it to slow down heaps), you'll find that it runs comp...

bijna 11 jaar ago | 1

Answered

Triangular surface

Simple example using |DelaunayTri|. First create a set of points N = 1000; theta = 2*pi*rand(N, 1); phi = acos(2*rand...

Triangular surface

Simple example using |DelaunayTri|. First create a set of points N = 1000; theta = 2*pi*rand(N, 1); phi = acos(2*rand...

bijna 11 jaar ago | 0

| accepted

Answered

[DISCONTINUED] Wish-list for MATLAB Answer sections.

Another thing that would be awesome would be the ability to submit a published m-file as an answer. Often I find myself answ...

[DISCONTINUED] Wish-list for MATLAB Answer sections.

Another thing that would be awesome would be the ability to submit a published m-file as an answer. Often I find myself answ...

bijna 11 jaar ago | 0

Answered

Help with identifiny change in curve shape automatically

What I think you're looking for are effectively the points of high curvature. If you have access to the curve fitting toolbox th...

Help with identifiny change in curve shape automatically

What I think you're looking for are effectively the points of high curvature. If you have access to the curve fitting toolbox th...

bijna 11 jaar ago | 1

| accepted

Answered

Need command help for a specific matrix operation

*EDIT* Needed to strain my eyes harder to figure out that the matrix in question had 4 rows C = [0 1 0 0; 0 0 1 0] * A.^2;

Need command help for a specific matrix operation

*EDIT* Needed to strain my eyes harder to figure out that the matrix in question had 4 rows C = [0 1 0 0; 0 0 1 0] * A.^2;

bijna 11 jaar ago | 1

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

bijna 11 jaar ago | 1

Answered

signals addition

Assuming they correspond to the same sampling rates, truncate one of them to be of the same length as the smaller one: n1 =...

signals addition

Assuming they correspond to the same sampling rates, truncate one of them to be of the same length as the smaller one: n1 =...

bijna 11 jaar ago | 0

| accepted

Answered

ODE45- How to pass parameters out

Why don't you just solve your ODE first, and then call the RHS function, modified to print out your parameters of interest, at t...

ODE45- How to pass parameters out

Why don't you just solve your ODE first, and then call the RHS function, modified to print out your parameters of interest, at t...

bijna 11 jaar ago | 1