matlab

How can I find unique rows in a matrix, with no element order within each row?

Hi, I have an array comprising n rows and 4 colums. Each of the four entries on the row is an integer, i.e., X = [ 111 112 432 2 6 9 115 111 112 432 111 2 ]; Each row represents the vertices of a tetrahedron. These vertices have no directionality thus, in the case above, the tetrahedra represented b...

Why does MATLAB native function cov (covariance matrix computation) use a different divisor than I expect?

Given a data matrix data of M dimensions and N samples, say, data = randn(N, M); I could compute the covariance matrix with data_mu = data - ones(N, 1)*mean(data); cov_matrix = (data_mu'*data_mu)./N If I use the native MATLAB function cov_matrix2 = cov(data) this will always be equal to cov_matrix = (data_mu'*data_mu)./(N-1) ...

How can access formulas as I process it with Matlab?

I load an xls file in Matlab, and I need not only the numeric values but the formulas also. Do you have any idea? ...

How do we load our symbolic expressions in the matlab?

Suppose we have expressions like u1=1/24*h*sin(3*t)-1/24*h*sin(3*t)*k+1/24*h*sin(t)-1/24*h*k*sin(t). After saving it in a .mat file how can we load it into matlab.I am new user of matlab. We are using symbolic toolbox of matlab version 5.3.After using char command we can save our expression in mat file or in other files too.For example,...

Matlab scripting, Customizing Figures

In Matlab scripting, how can I set two different Y-Axis for a single figure (one on the left and the other on the right side of the figure) ??? ...

constructing graphs in Java

hello everyone, i need to plot velocity graph for my velocity vector data(x axis velocity x comp, y axis velocity y comp). there is a quiver plot in matlab which does so, is it possible to some how draw such graphs in Java. please some one can tell how to do it, it would be real help. ...

can we use one expression(our choice) after using simple command?

Suppose we have expression like eq1=sin(t)*cos(t)^2-sin(t)*cos(t)^4.We want to simplify this expression by simple command of matlab.We get different forms in the matlab prompt. How can we use one of the desired form among them like "1/16*sin(3*t)+1/8*sin(t)-1/16*sin(5*t)" without cutting and pasting? Thanks in advance Anant ...

Can this piece of matlab script be vectorized further?

So what I am trying to do with this code is find all pixels on a line of an image that are below a certain threshold. The problem, however, is that this code is executed in a double for loop (yeah I know :( ), once for each pixel, so it's very slow. I'm wondering if there's anything else I can do. Some tips would be great, as I'm pretty...

Data Acquisition Toolbox for Matlab?

Has anyone here used the Matlab Data Acquisition Toolbox before? I've been spending a ton of time reading up on National Instruments products and their capabilities when used with Labview. However, Labview and NI hardware is pretty much the only thing I've looked at and I'm curious as to what is out there that competes with labview i...

Matlab- need help in plotting lines between points

I need help in plotting lines between points. Suppose, I start with creating 6 random points- x = rand(6,1); y = rand(6,1); So my points are (x(1),y(1)), (x(2),y(2)), (x(3),y(3)), (x(4),y(4)), (x(5),y(5)), (x(6),y(6)) Now I want to draw straight lines between the points 1 & 5, 2 & 6, 3 & 4 and plot them in a single diagram. So I get ...

matlab: stop and continue execution from debugger possible?

Is there any way to stop the execution of a matlab program from the debugger like ctrl+c does, but then being able to continue execution (like you can in say c#)? If not, is there any better way to workaround this other than trying to pre-emptively set break points or dbstop statements in your matlab code? I would like to be able to ...

Can this algorithm be simplified (written cleaner) ?

Hi, I have this algorithm, but I am not too keen on the many if-statements. Can someone see if this function can be written in a cleaner way? rand('twister',101) n = 10; f = A.^(0:n)./factorial(0:n); f = f/sum(f); n = 10000; Xi = 2; X = zeros(1,n); for i =1:n, dXi = (-1)^round(rand); Yi = Xi + dXi; if Yi > 0 & Yi <= leng...

MATLAB eval() function error

Hi all, eval() returns the same error, even with the simplest of inputs. >> ns=int2str(17) >> xs=num2str(18) >> d = eval(ns,'+',xs) ??? Index exceeds matrix dimensions. >> eval('1/2') ??? Index exceeds matrix dimensions. Any help would be appreciated. ...

MATLAB: finding islands of zeros in a sequence

Imagine you have a very long sequence. What is the most efficient way of finding the intervals where the sequence is all zeros (or more precisely the sequence drops to near-zero values abs(X)<eps): For simplicity, lets assume the following sequence: sig = [1 1 0 0 0 0 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0]; I'm trying to ge...

How do I plot a data series in F#?

Over on FSHUB, LethalLavaLand said, Let me plot my values! So the question is, how can I plot a data series in F# using built-in .NET 4.0 controls? ...

Construct adjacency matrix in MATLAB

Consider a set of points arranged on a grid of size N-by-M. I am trying to build the adjacency matrix such that neighboring points are connected. For example, in a 3x3 grid with a graph: 1-2-3 | | | 4-5-6 | | | 7-8-9 We should have the corresponding adjacency matrix: +---+------------------------------------------------------+ | |...

Threshold decomposition in Matlab

How do you do reconstruction by threshold decomposition in Matlab? Is there a function for it? ...

How to generate a net on a 8-dimensional sphere

Using Matlab, how to generate a net of 3^10 points that are evenly located (or distributed) on the 8-dimensional unit sphere? Thanks for any helpful answers! ...

Building a map from a matrix in Matlab

I have a matrix A which holds integers in a bounded range (0..255) and I need to build a table mapping a value (0..255) to all the coordinates in the matrix which hold this value. What is the best way to achieve this? - I thought about using containers.Map for the task but Map doesn't support multiple values per key. I could have used ...

how to convert 2D binary matrix to black & white plot?

i have a 2D binary matrix that i want to convert as a plot of black and white matrix.. please how this can be done ? can you please provide me with a code? let say i have 4*2 matrix it's entry as follow: 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 how this can be converted to black white matrix? some of my input binary matrices are of size 100*9, ...