Answered

How to extract only numerical values from cell into new column array?

s={"chb12_06.edf" "1665 seconds" "1726 seconds" "3415 seconds" "3447 seconds" "chb12_08.edf" "1426 seconds" "1439 seconds" "1591...

How to extract only numerical values from cell into new column array?

s={"chb12_06.edf" "1665 seconds" "1726 seconds" "3415 seconds" "3447 seconds" "chb12_08.edf" "1426 seconds" "1439 seconds" "1591...

10 hours ago | 0

Answered

How do I find the centre of gravity for an irregular shape?

You can get the coordinates of the centroid if you have a boundary coordinates of a polygonal region: [xc,yc] = polygoncentroid...

How do I find the centre of gravity for an irregular shape?

You can get the coordinates of the centroid if you have a boundary coordinates of a polygonal region: [xc,yc] = polygoncentroid...

14 hours ago | 0

Answered

Replace elements of a matrix by a smaller matrix which contains circular shaped values margins

C = A; sB = size(B); idx = {1+(1:sB(1)),1+(1:sB(2))}; % adjust offset 1 and 1 if B to be moved at other place C(idx{:}) = B ...

Replace elements of a matrix by a smaller matrix which contains circular shaped values margins

C = A; sB = size(B); idx = {1+(1:sB(1)),1+(1:sB(2))}; % adjust offset 1 and 1 if B to be moved at other place C(idx{:}) = B ...

16 hours ago | 0

| accepted

Answered

Is there anyway we can assign some specific values to a variable in the optimization problem?

Take x1 fix allowed value, e.g. 32, optimize wrt (x2,...), repeat 4 times pick the solutions (among 4) with smallest score value...

Is there anyway we can assign some specific values to a variable in the optimization problem?

Take x1 fix allowed value, e.g. 32, optimize wrt (x2,...), repeat 4 times pick the solutions (among 4) with smallest score value...

19 hours ago | 0

Answered

How to compute a Hankel matrix for N-dimension ?

Not sure what is the Hankel in 4-D but by extension in 2D it should be something like this w=5; x=4; y=3; z=2; b = rand(1,w...

How to compute a Hankel matrix for N-dimension ?

Not sure what is the Hankel in 4-D but by extension in 2D it should be something like this w=5; x=4; y=3; z=2; b = rand(1,w...

1 day ago | 0

| accepted

Answered

How to fit ellipse equation through segment of ellipse?

Warning: you won't ever get reilable ellipse with such as small portion of data. I'll still provide you a code (Optimization ...

How to fit ellipse equation through segment of ellipse?

Warning: you won't ever get reilable ellipse with such as small portion of data. I'll still provide you a code (Optimization ...

1 day ago | 1

Answered

How to gracefully truncate a matrix of unknown dimensions?

Input = rand(3,4,5) Dimension = 2; a=2; b=4; commaidx = cell(size(size(Input))); commaidx(:) = {':'}; commaidx{Dimension}...

How to gracefully truncate a matrix of unknown dimensions?

Input = rand(3,4,5) Dimension = 2; a=2; b=4; commaidx = cell(size(size(Input))); commaidx(:) = {':'}; commaidx{Dimension}...

3 days ago | 0

Answered

Find constraints on polynomial coefficients optimization

Why can't you implement ts := max(min(-a2/(2*a1),T),0); Then add the 6 constraints into your minimization pb: two non-linear ...

Find constraints on polynomial coefficients optimization

Why can't you implement ts := max(min(-a2/(2*a1),T),0); Then add the 6 constraints into your minimization pb: two non-linear ...

4 days ago | 0

| accepted

Answered

Vector decomposition with Matlab

b= [2; 1; 2; 1; 0; 1; 2; 1; 2] b1=min(b,1); b1([find(b==2,1,'first'),find(b==2,1,'last')])=2; b2=b-b1; n=length(b); tail=...

Vector decomposition with Matlab

b= [2; 1; 2; 1; 0; 1; 2; 1; 2] b1=min(b,1); b1([find(b==2,1,'first'),find(b==2,1,'last')])=2; b2=b-b1; n=length(b); tail=...

4 days ago | 1

| accepted

Answered

For a multidimensional array is it possible to return all other array dimensions for a single index of one dimension without having to use the colon for indexing?

Mdls = struct(); % Initialise Mdls as struct Mdls = repmat(Mdls,[2,4,6,8,6,4,2]); % Arbitrarily size the struct dim = 3; % dim...

For a multidimensional array is it possible to return all other array dimensions for a single index of one dimension without having to use the colon for indexing?

Mdls = struct(); % Initialise Mdls as struct Mdls = repmat(Mdls,[2,4,6,8,6,4,2]); % Arbitrarily size the struct dim = 3; % dim...

4 days ago | 0

| accepted

Answered

How to find the nearest positive definite matix

Find the smallest eigen value lbdmin of A (use for example EIGS function), then change A by adding A + max(-lbdmin,0)*eye(size...

How to find the nearest positive definite matix

Find the smallest eigen value lbdmin of A (use for example EIGS function), then change A by adding A + max(-lbdmin,0)*eye(size...

6 days ago | 1

Answered

What is the best way to generate samples from a multivariate complex normal distribution with an arbitrary covariance matrix?

% Generate test complex covariance matrix R sdp (m x m) m = 3; A = randn(m)+1i*randn(m); R = A'*A % Generate x, n-samples ...

What is the best way to generate samples from a multivariate complex normal distribution with an arbitrary covariance matrix?

% Generate test complex covariance matrix R sdp (m x m) m = 3; A = randn(m)+1i*randn(m); R = A'*A % Generate x, n-samples ...

7 days ago | 0

Answered

Should I set my bounds in the main function call or in the constraints function in global optimization?

In the lb, ub if you can. Then in linear constraints. then in non-linear constraints. Don't do in the main function. ...

Should I set my bounds in the main function call or in the constraints function in global optimization?

In the lb, ub if you can. Then in linear constraints. then in non-linear constraints. Don't do in the main function. ...

7 days ago | 0

| accepted

Answered

how can i separate a matrix into a multiplication of two matrices One of Real Values and the Other for Integer values.

Of course. Test matrix X = rand(5) n = length(X) then Z = ceil(1000*rand(n,n)) Y = X/Z Y*Z

how can i separate a matrix into a multiplication of two matrices One of Real Values and the Other for Integer values.

Of course. Test matrix X = rand(5) n = length(X) then Z = ceil(1000*rand(n,n)) Y = X/Z Y*Z

8 days ago | 1

| accepted

Answered

How to apply function eig to an array of matrices?

If your matrices is 2x2 or 3x3 you can use this FEX for eigen values, then this one for engen vectors.

How to apply function eig to an array of matrices?

If your matrices is 2x2 or 3x3 you can use this FEX for eigen values, then this one for engen vectors.

8 days ago | 0

Answered

Compare values of a matrix

It seems like you you want to cluster indexes according to correlation. In this case why not threshold you matrix, that gives so...

Compare values of a matrix

It seems like you you want to cluster indexes according to correlation. In this case why not threshold you matrix, that gives so...

10 days ago | 0

Answered

Find the intersection of two surfaces.

The mesh intersection is reduced to basic triangle-triangle intersection. There are few good pointers here: https://stackoverfl...

Find the intersection of two surfaces.

The mesh intersection is reduced to basic triangle-triangle intersection. There are few good pointers here: https://stackoverfl...

11 days ago | 1

Answered

Binary matrix in Matlab

If you have communications toolbox, create galois field array (with m=1) then apply inv.

Binary matrix in Matlab

If you have communications toolbox, create galois field array (with m=1) then apply inv.

12 days ago | 0

| accepted

Answered

How to solve a special linear equation Ax=b? A is a row vector.

If you have optimization toolbox A=[0.1+0.2i 0.2+0.3i 0.4+0.5i 0.6+7i 0.8+0.9i] b = 0.5+0.7i; nz = 2; AA = [real(A); imag(...

How to solve a special linear equation Ax=b? A is a row vector.

If you have optimization toolbox A=[0.1+0.2i 0.2+0.3i 0.4+0.5i 0.6+7i 0.8+0.9i] b = 0.5+0.7i; nz = 2; AA = [real(A); imag(...

12 days ago | 1

| accepted

Answered

Formulating maximization problem subject to null-space constraint

FMINCON (or any optimizer) cannot solve this kind of problem, your asmmissible space is not close set, since the constraint can ...

Formulating maximization problem subject to null-space constraint

FMINCON (or any optimizer) cannot solve this kind of problem, your asmmissible space is not close set, since the constraint can ...

14 days ago | 0

Answered

sum of multiplication for a vector and matrix

b*sum(A,2) Less operations than the first solution.

sum of multiplication for a vector and matrix

b*sum(A,2) Less operations than the first solution.

19 days ago | 1

Submitted

MultipleQR

Perform a bunch of QR factorization of same size matrix

20 days ago | 4 downloads |

Answered

counting the number of times a number appears next to the same one in a row?

>> A=[1 1 1 2 3 4 4 2] A = 1 1 1 2 3 4 4 2 >> sum(diff(A)==0 & diff([NaN, A(1:end-1)])...

counting the number of times a number appears next to the same one in a row?

>> A=[1 1 1 2 3 4 4 2] A = 1 1 1 2 3 4 4 2 >> sum(diff(A)==0 & diff([NaN, A(1:end-1)])...

24 days ago | 0

Answered

Quadprog 'interior-point-convex' failure

You can shift the input variable, it seems to work [y,fval,exitflag,output,lambda] = quadprog(H,f,A,b-A*x0,[],[],[],[],[],opts)...

Quadprog 'interior-point-convex' failure

You can shift the input variable, it seems to work [y,fval,exitflag,output,lambda] = quadprog(H,f,A,b-A*x0,[],[],[],[],[],opts)...

29 days ago | 2

Answered

Unexpected speed decrease of 2D Fourier Transform on GPU when iFFTed

If you want a fast FFT, make your data length power of 2, or product of small integers. 166 is bad since the prime factor is 2 ...

Unexpected speed decrease of 2D Fourier Transform on GPU when iFFTed

If you want a fast FFT, make your data length power of 2, or product of small integers. 166 is bad since the prime factor is 2 ...

1 month ago | 0

Answered

What happened to the figure toolbar in R2018b? Why is it an axes toolbar? How can I put the buttons back?

The "accepted answer" is a quick-and-dirty workaround about the problem. It still does not remove the annoying fading effect in ...

What happened to the figure toolbar in R2018b? Why is it an axes toolbar? How can I put the buttons back?

The "accepted answer" is a quick-and-dirty workaround about the problem. It still does not remove the annoying fading effect in ...

2 months ago | 0

Answered

mex file only found when in working directory, but not when in search path

If the MEX file is compiled with MSVS you might need to install the appropriate Redistributable on the target PC.

mex file only found when in working directory, but not when in search path

If the MEX file is compiled with MSVS you might need to install the appropriate Redistributable on the target PC.

4 months ago | 0

Answered

How can I generate a set containing all possible combinations?

A = nchoosek(1:8,4); A = num2cell(reshape(A',2,2,[]),[1 2]); A = A(:); % display A{:} Produces 70 2x2 matrices

How can I generate a set containing all possible combinations?

A = nchoosek(1:8,4); A = num2cell(reshape(A',2,2,[]),[1 2]); A = A(:); % display A{:} Produces 70 2x2 matrices

4 months ago | 0