Answered

How can I return real-valued eigenvectors from diagonalization?

I don't think it's possible: Looking at the eigenvalues and eigenvectors of B, >> diag(D) ans = 0.0000 + 2.0000i 0.000...

How can I return real-valued eigenvectors from diagonalization?

I don't think it's possible: Looking at the eigenvalues and eigenvectors of B, >> diag(D) ans = 0.0000 + 2.0000i 0.000...

4 months ago | 0

Answered

incorrect eigenvector using eig(A,B)

The residual MK*V-MM*V*w2 is expected to be numerically close to zero, however, you have to take into account the scaling of the...

incorrect eigenvector using eig(A,B)

The residual MK*V-MM*V*w2 is expected to be numerically close to zero, however, you have to take into account the scaling of the...

4 months ago | 0

Answered

highlight Nodecolor for a graph using a color map (JET)

Since colors is a n-by-3 array, use colors(i, :) to access the complete row that represents the color for node i. You can also u...

highlight Nodecolor for a graph using a color map (JET)

Since colors is a n-by-3 array, use colors(i, :) to access the complete row that represents the color for node i. You can also u...

5 months ago | 0

| accepted

Answered

Path between 2 nodes in a graph

Compute a path between the nodes, then check if the result is empty (this is returned by shortestpath if no path exists): path ...

Path between 2 nodes in a graph

Compute a path between the nodes, then check if the result is empty (this is returned by shortestpath if no path exists): path ...

5 months ago | 1

Answered

Diagonalising a Skew-Symmetric Matrix

When EIG is called with an exactly symmetric/hermitian matrix, MATLAB falls back to a specialized algorithm that guarantees that...

Diagonalising a Skew-Symmetric Matrix

When EIG is called with an exactly symmetric/hermitian matrix, MATLAB falls back to a specialized algorithm that guarantees that...

5 months ago | 2

| accepted

Answered

Properties of SVD of a hermitian matrix not holding at single precision

I'd suggest just calling EIG [V, S] = eig(A) instead of calling the SVD. If A is (exactly!) symmetric on input, this will retu...

Properties of SVD of a hermitian matrix not holding at single precision

I'd suggest just calling EIG [V, S] = eig(A) instead of calling the SVD. If A is (exactly!) symmetric on input, this will retu...

5 months ago | 0

| accepted

Answered

What is the difference between Gram-Smith QR decomposition procedure and qr.m function in Matlab?

MATLAB's QR decomposition is computed using Householder transformations, which is generally more numerically advantageous.

What is the difference between Gram-Smith QR decomposition procedure and qr.m function in Matlab?

MATLAB's QR decomposition is computed using Householder transformations, which is generally more numerically advantageous.

5 months ago | 0

| accepted

Answered

Plotting a graph in layered fashion

Unfortunately, there is currently no way to do this with the 'layered' layout. I'll make a note of your need for this. For now,...

Plotting a graph in layered fashion

Unfortunately, there is currently no way to do this with the 'layered' layout. I'll make a note of your need for this. For now,...

5 months ago | 0

Answered

Shortest path through nodes

As Bjorn mentioned, this is the traveling salesman problem. The optimization toolbox has an example of how to use their intlinpr...

Shortest path through nodes

As Bjorn mentioned, this is the traveling salesman problem. The optimization toolbox has an example of how to use their intlinpr...

6 months ago | 1

| accepted

Answered

lsqminnorm- Tolerance to Reduce Impact of Noisy Data

The tolerance in lsqminnorm should be used if you expect your matrix A to be of low rank up to a tolerance. That is, for rank k,...

lsqminnorm- Tolerance to Reduce Impact of Noisy Data

The tolerance in lsqminnorm should be used if you expect your matrix A to be of low rank up to a tolerance. That is, for rank k,...

6 months ago | 0

Answered

How do I get Matlab to display a graph type data structure with decreasing weights

The Edges table attached to a digraph is always standardized so that its sorted by the EndNodes column. However, you can get a c...

How do I get Matlab to display a graph type data structure with decreasing weights

The Edges table attached to a digraph is always standardized so that its sorted by the EndNodes column. However, you can get a c...

6 months ago | 0

| accepted

Answered

Ordering edge names in Digraph

The edges are reordered in the graph constructor, but it looks like the Power variable you're assigning is in the same order as ...

Ordering edge names in Digraph

The edges are reordered in the graph constructor, but it looks like the Power variable you're assigning is in the same order as ...

6 months ago | 0

| accepted

Answered

SVD of each row of a matrix

The SVD of a row vector has the singular value equal to its norm, and the singular vectors 1 and the normalized vector. If this...

SVD of each row of a matrix

The SVD of a row vector has the singular value equal to its norm, and the singular vectors 1 and the normalized vector. If this...

6 months ago | 0

| accepted

Answered

qr decomposition run-time performance

When a "~" is used for a return value, this is only for code clarity. MATLAB still needs to compute that value, so the second ca...

qr decomposition run-time performance

When a "~" is used for a return value, this is only for code clarity. MATLAB still needs to compute that value, so the second ca...

6 months ago | 2

Answered

Sign difference between coeff=pca(X) and [~,~,v] = svd(X)

I'm not sure why this happens. As mentioned by others, it doesn't matter what sign these outputs have. You could try stepping th...

Sign difference between coeff=pca(X) and [~,~,v] = svd(X)

I'm not sure why this happens. As mentioned by others, it doesn't matter what sign these outputs have. You could try stepping th...

6 months ago | 1

Answered

How to use non-unique node names in a digraph?

Instead of setting these inputs as node names, add them as a separate variable in the nodes table. Then, pass them to the plotti...

How to use non-unique node names in a digraph?

Instead of setting these inputs as node names, add them as a separate variable in the nodes table. Then, pass them to the plotti...

7 months ago | 0

| accepted

Answered

Is there any way to accelerate the solving of a series of large sparse positive definite linear equations "Ax=b" with same "A" and different "b"?

If you are able to solve for one vector using A \ b, you could pass in a matrix containing all your right-hand sides in instead:...

Is there any way to accelerate the solving of a series of large sparse positive definite linear equations "Ax=b" with same "A" and different "b"?

If you are able to solve for one vector using A \ b, you could pass in a matrix containing all your right-hand sides in instead:...

7 months ago | 2

Answered

Accelerate eigs with GPU

The eigs function is not supported on the GPU. There is support for sparse matrices on the GPU, since R2015a: Release notes para...

Accelerate eigs with GPU

The eigs function is not supported on the GPU. There is support for sparse matrices on the GPU, since R2015a: Release notes para...

7 months ago | 1

Answered

Properties of adjacency matrix

In terms of the adjacency matrix, a disconnected graph means that you can permute the rows and columns of this matrix in a way w...

Properties of adjacency matrix

In terms of the adjacency matrix, a disconnected graph means that you can permute the rows and columns of this matrix in a way w...

7 months ago | 0

Answered

Assigning values to an array of arbitrary dimensions in MATLAB.

Using the somewhat recent implicit expansion, this can also be done without indexing into every element of the array: function ...

Assigning values to an array of arbitrary dimensions in MATLAB.

Using the somewhat recent implicit expansion, this can also be done without indexing into every element of the array: function ...

8 months ago | 0

Answered

How to find all edges indexes if node indexes are given?

So you're looking for all edges where both end nodes are part of the set 4, 5, 6? This will compute them: >> [s, t] = findedge(...

How to find all edges indexes if node indexes are given?

So you're looking for all edges where both end nodes are part of the set 4, 5, 6? This will compute them: >> [s, t] = findedge(...

8 months ago | 0

| accepted

Answered

Create random graph with limited degree

You could start by just making an undirected graph, and then go through each node and compute its degree. If the degree is large...

Create random graph with limited degree

You could start by just making an undirected graph, and then go through each node and compute its degree. If the degree is large...

8 months ago | 0

Solved

Maximum of ND-array

Find the maximum element of a N dimensional array. Example: A=[1 2 4 ; -20 4 10]; The maximum is 10.

8 months ago

Answered

Result of A(:,:,1,1) coming as result of A(:,:,1,2)

The eigenvectors returned by EIG are returned in the same order as the eigenvalues, but the eigenvalues are not necessarily sort...

Result of A(:,:,1,1) coming as result of A(:,:,1,2)

The eigenvectors returned by EIG are returned in the same order as the eigenvalues, but the eigenvalues are not necessarily sort...

8 months ago | 0

Answered

How to find all related nodes in directed graph?

Another option is to use the weak connected components of the graph: bins = conncomp(G, 'Type', 'weak'); % bins(nid) gives th...

How to find all related nodes in directed graph?

Another option is to use the weak connected components of the graph: bins = conncomp(G, 'Type', 'weak'); % bins(nid) gives th...

8 months ago | 0

Answered

rotation of graph node labels

The labels will be straight in most layouts (all but 'circle', 'layered'). You can first use 'circle' layout and then convert to...

rotation of graph node labels

The labels will be straight in most layouts (all but 'circle', 'layered'). You can first use 'circle' layout and then convert to...

8 months ago | 0

| accepted

Answered

Error using matlab.graphics.chart.primitive.GraphPlot/highlight>checkSubgraph

Try using Gsol = graph(idxs(ledge,1),idxs(ledge,2), [], numnodes(G)); so that G and Gsol both have the same number of nodes. T...

Error using matlab.graphics.chart.primitive.GraphPlot/highlight>checkSubgraph

Try using Gsol = graph(idxs(ledge,1),idxs(ledge,2), [], numnodes(G)); so that G and Gsol both have the same number of nodes. T...

8 months ago | 0

| accepted

Answered

About "eigs" function

This was the case for old EIGS, it would use some random restart vectors that changed on every run. In the version of EIGS that ...

About "eigs" function

This was the case for old EIGS, it would use some random restart vectors that changed on every run. In the version of EIGS that ...

8 months ago | 1

Answered

Assign Numerical Node Labels

For the first call, use >> GG.Nodes.Name = num2str(Name)' - GG.Nodes.Name has to be a column vector. For the second call,...

Assign Numerical Node Labels

For the first call, use >> GG.Nodes.Name = num2str(Name)' - GG.Nodes.Name has to be a column vector. For the second call,...

8 months ago | 0

| accepted

Answered

How to find inverse of a 608*608 matrix fast?

The matrices in this file are symbolic, it's very expensive to compute with large arrays of these variables. If you cast it to f...

How to find inverse of a 608*608 matrix fast?

The matrices in this file are symbolic, it's very expensive to compute with large arrays of these variables. If you cast it to f...

8 months ago | 0

| accepted