Professional Interests: medical image processing, optimization algorithms

PLEASE NOTE: I do not read email sent through my author page. Please post questions about FEX submissions in their respective Comments section.

Answered

Generating adjacency matrix for following network

Perhaps as follows, n=6; T=nan(n,2); map=isnan(T); while any(map(:)) [i,~]=find(map,1); if ~map(i...

Generating adjacency matrix for following network

Perhaps as follows, n=6; T=nan(n,2); map=isnan(T); while any(map(:)) [i,~]=find(map,1); if ~map(i...

4 hours ago | 0

Answered

Extending a 2D lattice of points

You can use scatteredInterpolant() or griddata().

Extending a 2D lattice of points

You can use scatteredInterpolant() or griddata().

1 day ago | 0

Answered

Fmincon - Variable dependent constraints

If you wish, you can download prob2matrices() and use the problem-based framework to help set up the linear constraints. x=opti...

Fmincon - Variable dependent constraints

If you wish, you can download prob2matrices() and use the problem-based framework to help set up the linear constraints. x=opti...

1 day ago | 1

Answered

Tridiagonal Matrix with subdiagonal and main diagonal is also matrix

Here's another way, probably much faster. N=1000; a1=4;b1=-1; A =diag(a1*ones(1,N-1)) + diag(b1*ones(1,N-2),1) + diag(b1...

Tridiagonal Matrix with subdiagonal and main diagonal is also matrix

Here's another way, probably much faster. N=1000; a1=4;b1=-1; A =diag(a1*ones(1,N-1)) + diag(b1*ones(1,N-2),1) + diag(b1...

1 day ago | 0

Answered

Tridiagonal Matrix with subdiagonal and main diagonal is also matrix

So, you want a block Toeplitz matrix? N = 5; A =diag([7 4 4]); B=[8 8 10; 2 5 2; 10 8 7]; C=zeros(3); blocks={C,B,A}; ...

Tridiagonal Matrix with subdiagonal and main diagonal is also matrix

So, you want a block Toeplitz matrix? N = 5; A =diag([7 4 4]); B=[8 8 10; 2 5 2; 10 8 7]; C=zeros(3); blocks={C,B,A}; ...

1 day ago | 0

| accepted

Answered

Non-square FFT

There's probably no significant efficiency to be gained if you just want to get rid of half of the frequencies, as in the examp...

Non-square FFT

There's probably no significant efficiency to be gained if you just want to get rid of half of the frequencies, as in the examp...

2 days ago | 0

Answered

Optimize Function with two sums using fmincon

k = [5,7,11,13]; p = [1:4]; a0 = [pi/10, pi/8, pi/7, pi/5]; weights=(1./k.^4); weights=weights/sum(weights); fun = @(a)...

Optimize Function with two sums using fmincon

k = [5,7,11,13]; p = [1:4]; a0 = [pi/10, pi/8, pi/7, pi/5]; weights=(1./k.^4); weights=weights/sum(weights); fun = @(a)...

2 days ago | 0

Answered

Add missing numbers between elements in an array

Var1= [1 1 2 4 5 7 7 7 8 10 11 13 14 14 17 17 17 17 18 20]; Var2= [0.5 0.3 0.1 0.6 0.2 0.4 0.8 0.9 0.3 0.2 0.1 0.4 0.8 0.7 0.5 ...

Add missing numbers between elements in an array

Var1= [1 1 2 4 5 7 7 7 8 10 11 13 14 14 17 17 17 17 18 20]; Var2= [0.5 0.3 0.1 0.6 0.2 0.4 0.8 0.9 0.3 0.2 0.1 0.4 0.8 0.7 0.5 ...

2 days ago | 0

Answered

User defined function that evaluates anonymous function with variable number of inputs

The code would be a lot more efficient and tidy if you had the anonymous function accept an MxN array X. fun=@(X) X*[2,-1,-3,+9...

User defined function that evaluates anonymous function with variable number of inputs

The code would be a lot more efficient and tidy if you had the anonymous function accept an MxN array X. fun=@(X) X*[2,-1,-3,+9...

3 days ago | 0

Answered

Problem is unbounded with linprog

Another way to verify that there is no solution is to look at the dual linear program. min. 8*u+4*v s.t. 2*u +2*v >= ...

Problem is unbounded with linprog

Another way to verify that there is no solution is to look at the dual linear program. min. 8*u+4*v s.t. 2*u +2*v >= ...

3 days ago | 0

Answered

How to color grids underneath a curve and also gradient the grids depending on how much is within curve?

One way, xCenter = 10; yCenter = 10; radius = 10; theta = linspace(180, 270, 50); x = radius * cosd(theta) + xCenter; y = ...

How to color grids underneath a curve and also gradient the grids depending on how much is within curve?

One way, xCenter = 10; yCenter = 10; radius = 10; theta = linspace(180, 270, 50); x = radius * cosd(theta) + xCenter; y = ...

3 days ago | 0

Answered

Can I speed up this matrix multiplication?

For example, the size of Q is 1000x1000, but its rank is 10. If so, then we can decompose Q into a short sum where and are t...

Can I speed up this matrix multiplication?

For example, the size of Q is 1000x1000, but its rank is 10. If so, then we can decompose Q into a short sum where and are t...

3 days ago | 1

| accepted

Question

Malwarebytes thinks these Matlab files are malware

Malwarebytes flagged the 4 files below from my R2020b installation. Has anyone else experienced this? Can I safely assume it's a...

3 days ago | 0 answers | 1

Answered

sum of kronecker products(four loops)

For me, the following test for N=20 gives a very low percent error, so I would bet that the two are equivalent. N=20; [var1,va...

sum of kronecker products(four loops)

For me, the following test for N=20 gives a very low percent error, so I would bet that the two are equivalent. N=20; [var1,va...

4 days ago | 0

Answered

Version MATLAB 2020b: How can i convert an array to cell array with specific size?

output=mat2cell(MP1,1,Set)

Version MATLAB 2020b: How can i convert an array to cell array with specific size?

output=mat2cell(MP1,1,Set)

4 days ago | 0

| accepted

Answered

How can the data point, where values start to increase for the first time in a data, be found, as this increase continues at the following 30 values?

This uses the File Exchange contributions groupTrue and groupFcn (Download): G=groupTrue( diff(data)>0 ); g=find( groupFcn(...

How can the data point, where values start to increase for the first time in a data, be found, as this increase continues at the following 30 values?

This uses the File Exchange contributions groupTrue and groupFcn (Download): G=groupTrue( diff(data)>0 ); g=find( groupFcn(...

4 days ago | 0

| accepted

Answered

Calculate perimeter of a shape using x,y coordinates input to an array

pgon=polyshape(dataX,dataY); perimeter(pgon)

Calculate perimeter of a shape using x,y coordinates input to an array

pgon=polyshape(dataX,dataY); perimeter(pgon)

4 days ago | 0

Answered

Subtracting specific places in vector using diff

1- Not with |diff(). If you wanted to do that, it would be x(2:2:end)-x(1:2:end) 2. diff(X,n) approsimates the n-th derivative...

Subtracting specific places in vector using diff

1- Not with |diff(). If you wanted to do that, it would be x(2:2:end)-x(1:2:end) 2. diff(X,n) approsimates the n-th derivative...

4 days ago | 0

| accepted

Answered

linearly independent or linearly dependent.

If [S,v] and S have the same rank, then the column vector v must be a linear combination of the columns of the matrix S.Testing...

linearly independent or linearly dependent.

If [S,v] and S have the same rank, then the column vector v must be a linear combination of the columns of the matrix S.Testing...

4 days ago | 1

Answered

Optimisation error_constraint

Whenever Matlab complains that a variable is the wrong type, you should look at the variable you've made and check what type it ...

Optimisation error_constraint

Whenever Matlab complains that a variable is the wrong type, you should look at the variable you've made and check what type it ...

4 days ago | 0

| accepted

Answered

expanding matrix with linear line between new samples

B=[1 0 0 0 2 0 0 3]; x=find(B~=0); xq=1:numel(B); B=interp1(x,B(x),xq)

expanding matrix with linear line between new samples

B=[1 0 0 0 2 0 0 3]; x=find(B~=0); xq=1:numel(B); B=interp1(x,B(x),xq)

5 days ago | 0

| accepted

Answered

How to fill 3D array using for loop with data z allocated to specific x and y values

X=[0.5;0.5;0.6;0.6]; Y=[0.6;0.7;0.6;0.7]; V=[1.0794;1.1794;1.1646;1.2646]; [I,J,K]=ndgrid(1:le...

How to fill 3D array using for loop with data z allocated to specific x and y values

X=[0.5;0.5;0.6;0.6]; Y=[0.6;0.7;0.6;0.7]; V=[1.0794;1.1794;1.1646;1.2646]; [I,J,K]=ndgrid(1:le...

5 days ago | 0

| accepted

Answered

Too many output arguments while solving a constrained optimization problem.

You are reporting multiple different errors in multiple different places from multiple different Matlab versions, so it is a lit...

Too many output arguments while solving a constrained optimization problem.

You are reporting multiple different errors in multiple different places from multiple different Matlab versions, so it is a lit...

5 days ago | 0

| accepted

Answered

Counting distinct elements in a vector?

numel(unique(A)) or max(findgroups(A))

Counting distinct elements in a vector?

numel(unique(A)) or max(findgroups(A))

5 days ago | 0

| accepted

Answered

Too many output arguments while solving a constrained optimization problem.

I get no problem in R2020b once the last line is modified to, prob.solve(x0)

Too many output arguments while solving a constrained optimization problem.

I get no problem in R2020b once the last line is modified to, prob.solve(x0)

5 days ago | 0

Answered

How can I give a rotational velocity to spheres?

This uses AxelRot from the File Exchange (Download): figh = figure; %%Axes ax = axes('XLim',[-4 4],'YLim',[-4 4],'ZLim',[-4...

How can I give a rotational velocity to spheres?

This uses AxelRot from the File Exchange (Download): figh = figure; %%Axes ax = axes('XLim',[-4 4],'YLim',[-4 4],'ZLim',[-4...

5 days ago | 0

| accepted

Answered

Can I speed up this matrix multiplication?

I have tried gpuArray, but it cannot be faster than normal Matlab * operation (maybe my GPU is not good enough..) Depending on...

Can I speed up this matrix multiplication?

I have tried gpuArray, but it cannot be faster than normal Matlab * operation (maybe my GPU is not good enough..) Depending on...

6 days ago | 1

Answered

Can you organize scatter plot points?

This may be more along the lines of what you were originally looking for load Data; w=max( max(data,[],1) - min(data,[],...

Can you organize scatter plot points?

This may be more along the lines of what you were originally looking for load Data; w=max( max(data,[],1) - min(data,[],...

6 days ago | 0

Answered

Is there a way to vectorise this vector/matrix product?

G=real( sum((R*W).*conj(W),1) );

Is there a way to vectorise this vector/matrix product?

G=real( sum((R*W).*conj(W),1) );

6 days ago | 2

| accepted