5,254 total contributions since 2009

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

Why always NaNs in my script?

Because you are interpolating at locations outside the boundaries defined by x_grid,y_grid. The locations where you interpolate,...

Why always NaNs in my script?

Because you are interpolating at locations outside the boundaries defined by x_grid,y_grid. The locations where you interpolate,...

약 8시간 ago | 0

| accepted

Question

Decompose an N-dimensional array into outer products

The SVD gives us a way to decompose a square matrix A into a sum of outer products with a minimal number of terms. In other word...

약 12시간 ago | 0 answers | 0

Answered

Problem passing function to lsqnonlin with costant parameters

par1=______; par2=______; par3=______; lsqnonlin(@(x) myfunction(x,par1,par2,par3), __________); See also Passing ...

Problem passing function to lsqnonlin with costant parameters

par1=______; par2=______; par3=______; lsqnonlin(@(x) myfunction(x,par1,par2,par3), __________); See also Passing ...

1일 ago | 2

| accepted

Answered

Creating Convolution Matrix of 2D Kernel for Different Shapes of Convolution

Readability and clarity over performance. OK, can't get much simpler and more readable then the following: function [ mK ] = C...

Creating Convolution Matrix of 2D Kernel for Different Shapes of Convolution

Readability and clarity over performance. OK, can't get much simpler and more readable then the following: function [ mK ] = C...

1일 ago | 1

Answered

Creating Convolution Matrix of 2D Kernel for Different Shapes of Convolution

You could also use the convn method of my ndSparse class (Download). function [ mK ] = CreateImageConvMtx( mH, nRows, nCols, co...

Creating Convolution Matrix of 2D Kernel for Different Shapes of Convolution

You could also use the convn method of my ndSparse class (Download). function [ mK ] = CreateImageConvMtx( mH, nRows, nCols, co...

1일 ago | 0

Answered

Creating Convolution Matrix of 2D Kernel for Different Shapes of Convolution

You can use my func2mat (Download) utility. It will find the matrix form of any linear function and doesn't require any toolbox...

Creating Convolution Matrix of 2D Kernel for Different Shapes of Convolution

You can use my func2mat (Download) utility. It will find the matrix form of any linear function and doesn't require any toolbox...

1일 ago | 0

Answered

How to use GPU and CPU simultaneously in a for loop ?

You can't make the CPU and GPU do alternating loop iterations, but you can divide the slices of A into two batches, and make the...

How to use GPU and CPU simultaneously in a for loop ?

You can't make the CPU and GPU do alternating loop iterations, but you can divide the slices of A into two batches, and make the...

2일 ago | 1

| accepted

Answered

Converting scalar equations to Vector Equations

Use the vectorize command.

Converting scalar equations to Vector Equations

Use the vectorize command.

2일 ago | 0

| accepted

Answered

How can I implement cubic interpolation in Gradient Descent algorithm?

Since you have an analytical formula for z(x,y), why don't you just use that to calculate Z and its gradient exactly? Why are yo...

How can I implement cubic interpolation in Gradient Descent algorithm?

Since you have an analytical formula for z(x,y), why don't you just use that to calculate Z and its gradient exactly? Why are yo...

2일 ago | 0

Answered

Sequences for a 3D matrix

k=ones(1,1,2)/2; result = sum( convn(A,k,'valid')>.999 ,3 );

Sequences for a 3D matrix

k=ones(1,1,2)/2; result = sum( convn(A,k,'valid')>.999 ,3 );

2일 ago | 0

Answered

how to divide image into 5*5 blocks

A more efficient method than blockproc or mat2cell is to use sepblockfun (Download), result = sepblockfun(~yourImage,[60,60],'...

how to divide image into 5*5 blocks

A more efficient method than blockproc or mat2cell is to use sepblockfun (Download), result = sepblockfun(~yourImage,[60,60],'...

3일 ago | 0

Answered

Integrate with Simpson's Rule

It doesn't look like you xi should be involved, since you already have the samples of f I = h/3*(f((1))+2*sum(f((3:2:end-2)))+4...

Integrate with Simpson's Rule

It doesn't look like you xi should be involved, since you already have the samples of f I = h/3*(f((1))+2*sum(f((3:2:end-2)))+4...

3일 ago | 0

| accepted

Answered

How can I fit two functions simultaneously with lsqnonlin?

Replace your ^ operators with .^

How can I fit two functions simultaneously with lsqnonlin?

Replace your ^ operators with .^

6일 ago | 0

| accepted

Answered

Maximising the summation of a matrix elements along to generated trajectory by nonlinear global optimization

If fij is always binary, it seems very peculiar not to pose this as a least squares curvefit. If f is not binary (or even if i...

Maximising the summation of a matrix elements along to generated trajectory by nonlinear global optimization

If fij is always binary, it seems very peculiar not to pose this as a least squares curvefit. If f is not binary (or even if i...

6일 ago | 0

Answered

How to solve "Error while using repmat : out of memory"

Forget about repmats. Use the original sq and w as follows, tmp=reshape( reshape(sq,[],nd)*w , size(sq) ); raw = c...

How to solve "Error while using repmat : out of memory"

Forget about repmats. Use the original sq and w as follows, tmp=reshape( reshape(sq,[],nd)*w , size(sq) ); raw = c...

12일 ago | 1

| accepted

Answered

Write a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A, that is, elements in the counter-diagonal (going from the bottom left c

The code you've shown will return only the value A(1,1), e.g., A = 1 6 11 16 21 2 7 12 17 ...

Write a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A, that is, elements in the counter-diagonal (going from the bottom left c

The code you've shown will return only the value A(1,1), e.g., A = 1 6 11 16 21 2 7 12 17 ...

12일 ago | 1

Answered

How do I add shadings when overlapping polygons?

Why not just create a grayscale image? t= linspace(0,1,300); [X,Y]=meshgrid(t); sz=size(X); X=X(:);Y=Y(:); I=xy.isi...

How do I add shadings when overlapping polygons?

Why not just create a grayscale image? t= linspace(0,1,300); [X,Y]=meshgrid(t); sz=size(X); X=X(:);Y=Y(:); I=xy.isi...

12일 ago | 0

| accepted

Answered

Reconstruction of points position in 3D from 2D image

i was wondering about the fact that points are symmetric. Does this not add any info?... Can this help to reconstruct at least t...

Reconstruction of points position in 3D from 2D image

i was wondering about the fact that points are symmetric. Does this not add any info?... Can this help to reconstruct at least t...

13일 ago | 0

| accepted

Answered

How to constrain the lower and upper bounds in lsqcurvefit?

This seems to work okay, for i=1:2 [xdata,is]=sort(realpart(:, i)); ydata=imaginarypart(is, i); fun=@(m,xdata) (...

How to constrain the lower and upper bounds in lsqcurvefit?

This seems to work okay, for i=1:2 [xdata,is]=sort(realpart(:, i)); ydata=imaginarypart(is, i); fun=@(m,xdata) (...

14일 ago | 0

| accepted

Answered

Creating a number board from a matrix

You could also use uitable, e.g., f = figure; t = uitable(f,'Data',A,'Position',[20 20 262 204]);

Creating a number board from a matrix

You could also use uitable, e.g., f = figure; t = uitable(f,'Data',A,'Position',[20 20 262 204]);

14일 ago | 0

Answered

How to use The Minimum Error Thresholding method for CT images using Matlab?

You could pre-map your input image to have the intensity range expected by your code using imadjust, J = imadjust(I,[low_in...

How to use The Minimum Error Thresholding method for CT images using Matlab?

You could pre-map your input image to have the intensity range expected by your code using imadjust, J = imadjust(I,[low_in...

15일 ago | 0

| accepted

Question

Sampling with periodic replacement

I am looking for an efficient way of doing randperm(n,k) many successive times with the same n and k. Can anyone propose somethi...

16일 ago | 1 answer | 0

Answered

how to detect empty rows and columns from 3-D matrix and crop them?

tmp=any(Frames,3); I = any(tmp,2); J= any(tmp,1); Frames=Frames(I,J,:);

how to detect empty rows and columns from 3-D matrix and crop them?

tmp=any(Frames,3); I = any(tmp,2); J= any(tmp,1); Frames=Frames(I,J,:);

16일 ago | 1

| accepted

Answered

How to solve a revised quadratic program problem

Use fmincon. Be careful as well of the non-differentiability of the function at x=0. You should introduce a constraint that keep...

How to solve a revised quadratic program problem

Use fmincon. Be careful as well of the non-differentiability of the function at x=0. You should introduce a constraint that keep...

16일 ago | 1

| accepted

Answered

Pixel position is bigger than image dimension or negative using pinhole camera model

Here are a few errors that I can deduce from your description: You say that the point is "right in front of the camera" and tha...

Pixel position is bigger than image dimension or negative using pinhole camera model

Here are a few errors that I can deduce from your description: You say that the point is "right in front of the camera" and tha...

19일 ago | 2

| accepted

Answered

how to use genetic algorithm to solve these problems Using Genetic algorithm Toolbox ?

This page talks about how to set specific options programmatically in the ga command: https://www.mathworks.com/help/gads/optio...

how to use genetic algorithm to solve these problems Using Genetic algorithm Toolbox ?

This page talks about how to set specific options programmatically in the ga command: https://www.mathworks.com/help/gads/optio...

19일 ago | 0

Answered

Is there any way of working out the coordinates at D? AD and BD are perpendicular and in the plane ABC.

Is there any way of working out the coordinates at D? ... AD and BD are not necessarily equal in length Without a condition on ...

Is there any way of working out the coordinates at D? AD and BD are perpendicular and in the plane ABC.

Is there any way of working out the coordinates at D? ... AD and BD are not necessarily equal in length Without a condition on ...

19일 ago | 0

Answered

what is the maximum diameter of convex polygons ?

You can prove it using some theorems below from convex analysis. You should be able to find them in any convex analysis text, bu...

what is the maximum diameter of convex polygons ?

You can prove it using some theorems below from convex analysis. You should be able to find them in any convex analysis text, bu...

21일 ago | 1