Answered

Row & Column Wise Normalisation

For a non-negative square matrix, the attached article mentions necessary and sufficient conditions (p. 3, Theorem 1) both for t...

Row & Column Wise Normalisation

For a non-negative square matrix, the attached article mentions necessary and sufficient conditions (p. 3, Theorem 1) both for t...

11 days ago | 2

| accepted

Answered

How to move programmatically existing datatip

Maybe you can use the advice here, https://www.mathworks.com/matlabcentral/answers/100545-how-can-i-programmatically-control-mo...

How to move programmatically existing datatip

Maybe you can use the advice here, https://www.mathworks.com/matlabcentral/answers/100545-how-can-i-programmatically-control-mo...

11 days ago | 1

Answered

How to solve Too many input arguments error? Error in Fminsearch (line 200) fv(:,1) = funfcn(x,varargin{:});

This fh handles should be, fh{n}= @(x)vpe(x,p,MSM(:,n),erps(:,n),n);

How to solve Too many input arguments error? Error in Fminsearch (line 200) fv(:,1) = funfcn(x,varargin{:});

This fh handles should be, fh{n}= @(x)vpe(x,p,MSM(:,n),erps(:,n),n);

12 days ago | 0

| accepted

Answered

A is a matrix of size 32*32.I want to subtract elements of each 4*4 block of A from their respective 4*4 means

out = blockproc(A,[4 4],@(x)mean(x.data(:))); result = A - repelem( out , 4,4);

A is a matrix of size 32*32.I want to subtract elements of each 4*4 block of A from their respective 4*4 means

out = blockproc(A,[4 4],@(x)mean(x.data(:))); result = A - repelem( out , 4,4);

12 days ago | 0

| accepted

Answered

Reducing repeated elements in an array by a factor

Another method, one which avoids for-loops inherent in cell2mat, V=[1,2,2,2,0,2,2,2,5,5,5,5,5,5,6,6,6]; N=3; X = cumsum...

Reducing repeated elements in an array by a factor

Another method, one which avoids for-loops inherent in cell2mat, V=[1,2,2,2,0,2,2,2,5,5,5,5,5,5,6,6,6]; N=3; X = cumsum...

12 days ago | 0

Answered

The support on here is horrible, does anyone have an api for the function calls? I'm tired of searching only to find examples of what I don't need.

Matlab Answers is a discussion forum, not a documentation browser. If you want to find documentation, start here, https://www.m...

The support on here is horrible, does anyone have an api for the function calls? I'm tired of searching only to find examples of what I don't need.

Matlab Answers is a discussion forum, not a documentation browser. If you want to find documentation, start here, https://www.m...

14 days ago | 2

Answered

How to use fimplicit with a symbolic function

Using matlabFunction, you can derive a non-symbolic version of your circle equation expression from the symbolic version, >> ci...

How to use fimplicit with a symbolic function

Using matlabFunction, you can derive a non-symbolic version of your circle equation expression from the symbolic version, >> ci...

14 days ago | 0

Answered

How can I get the elements from a matrix and use them as the coordinates in another matrix

D = C( sub2ind( size(C), W(:,1:end-1), W(:,2:end) ) ), sum(D,2)

How can I get the elements from a matrix and use them as the coordinates in another matrix

D = C( sub2ind( size(C), W(:,1:end-1), W(:,2:end) ) ), sum(D,2)

14 days ago | 0

| accepted

Answered

A class to simulate missing arguments in function calls

The main drawback is that one must always use myfeval, which is not very readable. Yet another solution, which might address th...

A class to simulate missing arguments in function calls

The main drawback is that one must always use myfeval, which is not very readable. Yet another solution, which might address th...

14 days ago | 0

Answered

Multiple selection of an array

You can use sepblockfun downloadable from here https://www.mathworks.com/matlabcentral/fileexchange/48089-separable-block-wise-...

Multiple selection of an array

You can use sepblockfun downloadable from here https://www.mathworks.com/matlabcentral/fileexchange/48089-separable-block-wise-...

14 days ago | 0

Answered

A class to simulate missing arguments in function calls

Clearly, I would have to check for each input argument to be ~isempty(), or ~isnan(), which could be another technique. However,...

A class to simulate missing arguments in function calls

Clearly, I would have to check for each input argument to be ~isempty(), or ~isnan(), which could be another technique. However,...

17 days ago | 0

| accepted

Answered

A class to simulate missing arguments in function calls

Seems to me that you can effectively accomplish what you want by defining a trivial class with no properties or methods, classd...

A class to simulate missing arguments in function calls

Seems to me that you can effectively accomplish what you want by defining a trivial class with no properties or methods, classd...

17 days ago | 0

Answered

Evaluating a complicated integral in Matlab gives NaN

Your integrand has a singularity at psi = pi/2. So perhaps try, f2(i) = integral(f1, 0, pi/2*(1-eps), 'ArrayValued', true);

Evaluating a complicated integral in Matlab gives NaN

Your integrand has a singularity at psi = pi/2. So perhaps try, f2(i) = integral(f1, 0, pi/2*(1-eps), 'ArrayValued', true);

18 days ago | 1

Answered

How to find "rectangular" corners?

Use pgonCorners from the File Exchange (Download). It applies to any convex polyhedron. numVertices=4; corners=pgonCorners(I...

How to find "rectangular" corners?

Use pgonCorners from the File Exchange (Download). It applies to any convex polyhedron. numVertices=4; corners=pgonCorners(I...

18 days ago | 1

Answered

How can I change the 'MaxIterations' option in matlab 'createOptimProblem('fmincon',..........)'

You need to do this, opts=optimoptions('fmincon', 'MaxFunctionEvaluations',3000); problem = createOptimProblem('fmincon','x0...

How can I change the 'MaxIterations' option in matlab 'createOptimProblem('fmincon',..........)'

You need to do this, opts=optimoptions('fmincon', 'MaxFunctionEvaluations',3000); problem = createOptimProblem('fmincon','x0...

19 days ago | 1

| accepted

Answered

Inconsistency in the definition of two geometric transformation matrices (tform)

The second form is the one expected by maketform. The only difference between the two conventions is that with the first, the tr...

Inconsistency in the definition of two geometric transformation matrices (tform)

The second form is the one expected by maketform. The only difference between the two conventions is that with the first, the tr...

19 days ago | 0

| accepted

Submitted

Find vertices in image of convex polygon

Estimates the corner points of a pixelated convex polygon having a known number of vertices.

19 days ago | 9 downloads |

Answered

How can I find the coordinates of the top and bottom end plate and calculate the height?

The FEX submission pgonCorners (Download) can be used to find approximate corners for each of the vertebrae. Once you have the c...

How can I find the coordinates of the top and bottom end plate and calculate the height?

The FEX submission pgonCorners (Download) can be used to find approximate corners for each of the vertebrae. Once you have the c...

19 days ago | 0

| accepted

Answered

How to get the maximum value of an implicit function?

I believe this method does not allow me to change the number of points in X, It does, e.g., f = fimplicit(fun,[0,40,0,9],'Mesh...

How to get the maximum value of an implicit function?

I believe this method does not allow me to change the number of points in X, It does, e.g., f = fimplicit(fun,[0,40,0,9],'Mesh...

20 days ago | 0

Answered

How to avoid looping of anonymous function?

You could make it the end-user's responsibility to enter the function in anonymous form, >> f=input('Enter anonymous function: ...

How to avoid looping of anonymous function?

You could make it the end-user's responsibility to enter the function in anonymous form, >> f=input('Enter anonymous function: ...

20 days ago | 0

Answered

Fit image datapoints to curve

You would use a 2D version of an Iterative Closest Point (ICP) algorithm. This FEX contribution appears to have one: https://ww...

Fit image datapoints to curve

You would use a 2D version of an Iterative Closest Point (ICP) algorithm. This FEX contribution appears to have one: https://ww...

21 days ago | 0

Answered

Write a script that calculates the user produced polynomial. The polynomial can be input until the user decides to terminate the program.

If you have the Symbolic Math Toolbox and wish to manipulate the polynomials in symbolic form, you can use poly2sym, >> p = inp...

Write a script that calculates the user produced polynomial. The polynomial can be input until the user decides to terminate the program.

If you have the Symbolic Math Toolbox and wish to manipulate the polynomials in symbolic form, you can use poly2sym, >> p = inp...

26 days ago | 1

| accepted

Answered

sparse and gpuArray/sparse errors very odd! (with MWE)

Ultimately, the reason is that you are creating matrices that violate various internal array size restrictions. There are differ...

sparse and gpuArray/sparse errors very odd! (with MWE)

Ultimately, the reason is that you are creating matrices that violate various internal array size restrictions. There are differ...

26 days ago | 1

Answered

"Index exceeds the number of array elements"

Perhaps this is what you are looking for, function [Ex, Ey, Ez] = E_field(x,y,z) R_s = 0.02; V = 0; epnaut = 8...

"Index exceeds the number of array elements"

Perhaps this is what you are looking for, function [Ex, Ey, Ez] = E_field(x,y,z) R_s = 0.02; V = 0; epnaut = 8...

27 days ago | 0

| accepted

Answered

how to do violin plot in matlab

Here's my personal favorite. https://github.com/bastibe/Violinplot-Matlab

how to do violin plot in matlab

Here's my personal favorite. https://github.com/bastibe/Violinplot-Matlab

27 days ago | 0

| accepted

Answered

Can't figure out what I am doing wrong. Looking to find square root using the equation given x=(x+x/a)/2. I also feel like I am not making use of the approximation errors ea and es.

You need to take absolute values, ea=abs((x-x_old)/x)*100;

Can't figure out what I am doing wrong. Looking to find square root using the equation given x=(x+x/a)/2. I also feel like I am not making use of the approximation errors ea and es.

You need to take absolute values, ea=abs((x-x_old)/x)*100;

27 days ago | 1

| accepted

Answered

Unable to convert expression into double array

One way is to convert the symbolic expression to a function with matlabFunction. Then you can pass values to it as for any funct...

Unable to convert expression into double array

One way is to convert the symbolic expression to a function with matlabFunction. Then you can pass values to it as for any funct...

28 days ago | 0

| accepted

Answered

Finding the matrix I generated two iterations back, while loop

One option is to maintain a list of the last two D's in a cell array: C = [0 0 0; 1 1 1;0 0 0]; B = [zeros(1, N); C; zeros(...

Finding the matrix I generated two iterations back, while loop

One option is to maintain a list of the last two D's in a cell array: C = [0 0 0; 1 1 1;0 0 0]; B = [zeros(1, N); C; zeros(...

28 days ago | 0

| accepted

Answered

Newton's Method in Matlab

Did you check whether the while loop is ever executed, even once? I don't think it is.

Newton's Method in Matlab

Did you check whether the while loop is ever executed, even once? I don't think it is.

28 days ago | 1

Answered

Constraining Function in fmincon

Now that the problem is clearer, it appears to me that you could have done the whole thing with linprog, f=[2,1]*t; Aineq = -...

Constraining Function in fmincon

Now that the problem is clearer, it appears to me that you could have done the whole thing with linprog, f=[2,1]*t; Aineq = -...

28 days ago | 0