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

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

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

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

3 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

3 months ago | 0

Question

New feature Mex Out-of-Process

In the R2019a, there is a new feature that I think it's useful for people like me(us) that uses heavily MEX in the projects. ht...

3 months ago | 0 answers | 1

Answered

Create an accurate boundary around 2D point cloud horizontal plane

You might take a look at traveling saleman problem, there are several efficient implementation in File Exchange

Create an accurate boundary around 2D point cloud horizontal plane

You might take a look at traveling saleman problem, there are several efficient implementation in File Exchange

3 months ago | 1

Answered

How to mask a circle in perspective projection?

@Maayan please make an effort to give feedback to various answer/questions addressed to you. Just update the persective code in...

How to mask a circle in perspective projection?

@Maayan please make an effort to give feedback to various answer/questions addressed to you. Just update the persective code in...

4 months ago | 1

| accepted

Question

Update and Matlab Compenent Runtime

Does anyone know if the MCR installer (for compiled version of a code) gets an update whenever the regular MATLAB get an update ...

5 months ago | 1 answer | 1

Question

Release note of the update?

Is there a release note for the update in general, for Update2 R2018B in particular? Just wonder since the update 2 of R2018B a...

5 months ago | 1 answer | 0

Answered

Optimize the Max Min over two sets for the given function

For ant row a_j, the inner equation argmin_lambda || sum (lambda_i * b_i - a_j) ||^2 lambda >= 0 sum(lambda_i) = 1 can be s...

Optimize the Max Min over two sets for the given function

For ant row a_j, the inner equation argmin_lambda || sum (lambda_i * b_i - a_j) ||^2 lambda >= 0 sum(lambda_i) = 1 can be s...

5 months ago | 0

Answered

How to efficiently compare two matrix to get a single reference value?

TrueVal= [1 1 1 2 2 2 3 3 3 1 2]'; Predicted=[1 2 3 1 2 3 1 2 3 3 2]'; [ut,~,it] = unique(TrueVal); [up,~,ip] = unique(Pre...

How to efficiently compare two matrix to get a single reference value?

TrueVal= [1 1 1 2 2 2 3 3 3 1 2]'; Predicted=[1 2 3 1 2 3 1 2 3 3 2]'; [ut,~,it] = unique(TrueVal); [up,~,ip] = unique(Pre...

5 months ago | 0

Answered

Flipping a plot by 180 degrees

[x,y]=find(peaks>0.7) close all subplot(2,1,1); plot(x,y,'or') subplot(2,1,2); plot(x,y,'or'); % This command will r...

Flipping a plot by 180 degrees

[x,y]=find(peaks>0.7) close all subplot(2,1,1); plot(x,y,'or') subplot(2,1,2); plot(x,y,'or'); % This command will r...

5 months ago | 0

| accepted

Answered

gauss elimination or inverse

P = polyfit(x(:),y(:),n-1); a = P(1); b = P(2); ... c = P(n);

gauss elimination or inverse

P = polyfit(x(:),y(:),n-1); a = P(1); b = P(2); ... c = P(n);

5 months ago | 1

Answered

Error using:mtimesx_build.m

If you run recent MATLAB you also must change the line #166 of mtimex_build.m to mexopts = [prefdir '\mex_C_win64.xml'];

Error using:mtimesx_build.m

If you run recent MATLAB you also must change the line #166 of mtimex_build.m to mexopts = [prefdir '\mex_C_win64.xml'];

5 months ago | 0

Answered

How to create a random binary matrix with equal number of ones in each column and equal number of 1 in each row ?

See the same question here

How to create a random binary matrix with equal number of ones in each column and equal number of 1 in each row ?

See the same question here

5 months ago | 0

Answered

replacing for loop with more efficient code

% Generate test matrices m = 5; n = 10; S = rand(n,n); S = 0.5*(S + S.'); X = rand(n,n); X = 0.5*(X + X.'); A = zeros(n...

replacing for loop with more efficient code

% Generate test matrices m = 5; n = 10; S = rand(n,n); S = 0.5*(S + S.'); X = rand(n,n); X = 0.5*(X + X.'); A = zeros(n...

5 months ago | 0

| accepted

Answered

Generate N random uniformly distributed points in the d-ball

d = 3 n = 10000; % s is (d x n), n points in unit d-ball s = randn(d,n); r = rand(1,n).^(1/d); c = r./sqrt(sum(s.^2,1)); ...

Generate N random uniformly distributed points in the d-ball

d = 3 n = 10000; % s is (d x n), n points in unit d-ball s = randn(d,n); r = rand(1,n).^(1/d); c = r./sqrt(sum(s.^2,1)); ...

5 months ago | 0

Answered

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

"We’d like to move towards being able to define interactions at the axes level, instead of the figure level, since interactions ...

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

"We’d like to move towards being able to define interactions at the axes level, instead of the figure level, since interactions ...

5 months ago | 2

Answered

Difference between angle2dcm and eul2rotm (same angle sequence, different result)

I check and the eul2rotm command returns the rotation matrix according to Wikipedia definition of euler z-y'-x" intrinsic to rot...

Difference between angle2dcm and eul2rotm (same angle sequence, different result)

I check and the eul2rotm command returns the rotation matrix according to Wikipedia definition of euler z-y'-x" intrinsic to rot...

6 months ago | 0

Answered

Average the 3rd dimension in a matrix

Mean every 4 indices of the third dimension A=rand(360,181,360); [m,n,p] = size(A); m = mean(permute(reshape(A,m,n,4,[]),[1 ...

Average the 3rd dimension in a matrix

Mean every 4 indices of the third dimension A=rand(360,181,360); [m,n,p] = size(A); m = mean(permute(reshape(A,m,n,4,[]),[1 ...

6 months ago | 0

| accepted

Answered

Remove rows with consecutive numbers

A = [1 2 3 4 5; 3 5 7 9 11; 1 1 4 5 7; 3 5 6 6 9; ...

Remove rows with consecutive numbers

A = [1 2 3 4 5; 3 5 7 9 11; 1 1 4 5 7; 3 5 6 6 9; ...

6 months ago | 0

Answered

How to find curvature(k) of plane curve have having using it's position points (x & y) equally spaced with arc length s.

Big Curvature -> red Small Curvature -> blue % Dummy test data t = 1:7; x = rand(size(t)); y = rand(size(t)); fx = spl...

How to find curvature(k) of plane curve have having using it's position points (x & y) equally spaced with arc length s.

Big Curvature -> red Small Curvature -> blue % Dummy test data t = 1:7; x = rand(size(t)); y = rand(size(t)); fx = spl...

6 months ago | 0

| accepted

Answered

Is there a way to start indexing with 0 in MATLAB?

Yes, but you won't get much support by built-in array stock function >> M = containers.Map('KeyType','uint32','ValueType','dou...

Is there a way to start indexing with 0 in MATLAB?

Yes, but you won't get much support by built-in array stock function >> M = containers.Map('KeyType','uint32','ValueType','dou...

6 months ago | 3

Answered

Rotational symmetries of cubic crystal structures

xcord=[0 1 0 0 1 1 0 1]; ycord=[0 0 1 0 1 0 1 1]; zcord=[0 0 0 1 0 1 1 1]; xyz = [xcord; ycord; zcord]; theta = pi/3; M =...

Rotational symmetries of cubic crystal structures

xcord=[0 1 0 0 1 1 0 1]; ycord=[0 0 1 0 1 0 1 1]; zcord=[0 0 0 1 0 1 1 1]; xyz = [xcord; ycord; zcord]; theta = pi/3; M =...

6 months ago | 1

Answered

how to find maximum distance of convex polygon for each point in a convex hull?

This is a method that provides the maximum distance that has better complexity than computing distance of all pairs as other ans...

how to find maximum distance of convex polygon for each point in a convex hull?

This is a method that provides the maximum distance that has better complexity than computing distance of all pairs as other ans...

6 months ago | 0

Answered

Rotate a Matrix by Finding an Axis

Here is the code to find the largest distance between 2 white pixels. Once finding it you can compute the angle and rotate the ...

Rotate a Matrix by Finding an Axis

Here is the code to find the largest distance between 2 white pixels. Once finding it you can compute the angle and rotate the ...

6 months ago | 0

| accepted

Answered

Optimize the Max Min over two sets for the given function

Not sure why this bla-bla about convex that makes your statement confusing. There is no continuous variable in the quantity f2 =...

Optimize the Max Min over two sets for the given function

Not sure why this bla-bla about convex that makes your statement confusing. There is no continuous variable in the quantity f2 =...

6 months ago | 0

Answered

Solve for diagonal matrix D by minimizing the operator norm in Matlab

fminunc, fmincon and family.

Solve for diagonal matrix D by minimizing the operator norm in Matlab

fminunc, fmincon and family.

6 months ago | 1

| accepted