6,033 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

Rasterize a triangle in 3-D space.

One way is to use vert2lcon, https://www.mathworks.com/matlabcentral/fileexchange/30892-analyze-n-dimensional-polyhedra-in-term...

Rasterize a triangle in 3-D space.

One way is to use vert2lcon, https://www.mathworks.com/matlabcentral/fileexchange/30892-analyze-n-dimensional-polyhedra-in-term...

2 days ago | 0

Answered

How to find the x and y coordinates corresponding to a given value of f(x,y)?

maxval=max(f(:)); [xmax,ymax]=find(f==maxval);

How to find the x and y coordinates corresponding to a given value of f(x,y)?

maxval=max(f(:)); [xmax,ymax]=find(f==maxval);

2 days ago | 1

| accepted

Answered

Why do results of fft() on a matrix differ from fft() on one row as a vector?

The same dicrepancy exists with most Matlab functions that do operations along rows or columns. Here is the same test replacing ...

Why do results of fft() on a matrix differ from fft() on one row as a vector?

The same dicrepancy exists with most Matlab functions that do operations along rows or columns. Here is the same test replacing ...

2 days ago | 1

| accepted

Answered

why the script show wrong output can you help me?

tplot=[0:0.01:2*pi]; x=double(subs(pos,tplot)); y=double(subs(v,tplot)); z=double(subs(a,tplot)); p=plot3(x,y,z);

why the script show wrong output can you help me?

tplot=[0:0.01:2*pi]; x=double(subs(pos,tplot)); y=double(subs(v,tplot)); z=double(subs(a,tplot)); p=plot3(x,y,z);

2 days ago | 0

Answered

From a set of curves, how to find the one that the "most similar" to the reference curve?

The code below uses fminspleas https://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas to do a simple 1D registr...

From a set of curves, how to find the one that the "most similar" to the reference curve?

The code below uses fminspleas https://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas to do a simple 1D registr...

3 days ago | 0

Answered

Sparse gpuArray accumulation in for-loop

I would guess that your Kernel matrix is becoming less and less sparse as you accumulate until its memory consumption is growing...

Sparse gpuArray accumulation in for-loop

I would guess that your Kernel matrix is becoming less and less sparse as you accumulate until its memory consumption is growing...

3 days ago | 0

| accepted

Answered

Optimization with loops Error in optim.problemdef.OptimizationProblem/solve

I believe it will probably involve multiplication by some upper triangle matrices of 1 with some other operations but I cannot w...

Optimization with loops Error in optim.problemdef.OptimizationProblem/solve

I believe it will probably involve multiplication by some upper triangle matrices of 1 with some other operations but I cannot w...

3 days ago | 0

| accepted

Answered

Find the points on circumference of a circle

Okay Considering 5 pixels + or - for the inaccuracy to find all the x,y, points on the circumference; how can I find even those....

Find the points on circumference of a circle

Okay Considering 5 pixels + or - for the inaccuracy to find all the x,y, points on the circumference; how can I find even those....

4 days ago | 0

Answered

Matlab code to split an image into a square grid of square blocks

This uses mat2tiles (Download) A=mat2tiles( imread('cameraman.tif'), [32,32]); [m,n]=size(A); B=cell2mat(A(randperm(...

Matlab code to split an image into a square grid of square blocks

This uses mat2tiles (Download) A=mat2tiles( imread('cameraman.tif'), [32,32]); [m,n]=size(A); B=cell2mat(A(randperm(...

4 days ago | 0

| accepted

Answered

Find matching points from two coordinate systems

If the shear component of the deformation isn't too strong, the matchpoints function defined below might work. It will sort the ...

Find matching points from two coordinate systems

If the shear component of the deformation isn't too strong, the matchpoints function defined below might work. It will sort the ...

5 days ago | 0

Answered

Find cycles in an undirected graph

Because this sounds like a generally useful thing, I cooked up the attached polyregions class to do the partitioning that you de...

Find cycles in an undirected graph

Because this sounds like a generally useful thing, I cooked up the attached polyregions class to do the partitioning that you de...

5 days ago | 1

| accepted

Answered

Function handle for combinations of calculations

One way: N=5; [G{1:N}]=ndgrid([-1,1]); G=reshape(cat(N+1,G{:}) , [],N); and now the combinations are given by ...

Function handle for combinations of calculations

One way: N=5; [G{1:N}]=ndgrid([-1,1]); G=reshape(cat(N+1,G{:}) , [],N); and now the combinations are given by ...

5 days ago | 0

| accepted

Answered

I need help with this MATLAB question

I know how to get user input but how do i get it through a pop up box? One option is inputdlg, https://www.mathworks.com/help...

I need help with this MATLAB question

I know how to get user input but how do i get it through a pop up box? One option is inputdlg, https://www.mathworks.com/help...

5 days ago | 1

Answered

How do I reorder unequal columns in a field

yourStruct.Vs=permute(yourStruct.Vs,[2,1,3]);

How do I reorder unequal columns in a field

yourStruct.Vs=permute(yourStruct.Vs,[2,1,3]);

6 days ago | 0

Answered

How to use polyfit for a table of values

That would occur if mpg or horsepower contain NaNs. You should remove them.

How to use polyfit for a table of values

That would occur if mpg or horsepower contain NaNs. You should remove them.

6 days ago | 0

| accepted

Answered

Using maximum of optimisation variable as an upper bound for another variable

Solve N different sub-problems for j=1:N prob.Constraint.TotalCost = sum(x)=CostPerkW*x(j); prob.Constraint.Max =...

Using maximum of optimisation variable as an upper bound for another variable

Solve N different sub-problems for j=1:N prob.Constraint.TotalCost = sum(x)=CostPerkW*x(j); prob.Constraint.Max =...

6 days ago | 0

| accepted

Answered

Error using griddedInterpolant Grid coordinates must be of the same type, single or double.

You should convert all your variables to double floats.

Error using griddedInterpolant Grid coordinates must be of the same type, single or double.

You should convert all your variables to double floats.

7 days ago | 0

| accepted

Answered

how to solve Error using .' Transpose on ND array is not defined. Use PERMUTE instead. Error in interp2 (line 122) V = V.';?

Because precip is not a 2D array, interp2 is the wrong tool. One alternative: F=griddedInterpolant({lat,lon,t},precip); newp...

how to solve Error using .' Transpose on ND array is not defined. Use PERMUTE instead. Error in interp2 (line 122) V = V.';?

Because precip is not a 2D array, interp2 is the wrong tool. One alternative: F=griddedInterpolant({lat,lon,t},precip); newp...

7 days ago | 0

| accepted

Answered

calculate rotation of an object using three markers connected to an object

You can use this FEX file to calculate the rotation of a set of points, https://www.mathworks.com/matlabcentral/fileexchange/26...

calculate rotation of an object using three markers connected to an object

You can use this FEX file to calculate the rotation of a set of points, https://www.mathworks.com/matlabcentral/fileexchange/26...

9 days ago | 1

| accepted

Answered

Solving a system of nonlinear equations with unorganized unknowns?

If you use lsqnonlin instead of fsolve, you can set a vector of upper and lower bounds ub and lb on the solution. Just set ub(i)...

Solving a system of nonlinear equations with unorganized unknowns?

If you use lsqnonlin instead of fsolve, you can set a vector of upper and lower bounds ub and lb on the solution. Just set ub(i)...

9 days ago | 0

Answered

How can i write optimal control objective with fmincon?

Same as any objective... Knowns=[lambda1,lambda2]; Jfun=@(Unknowns) objective(Unknowns,Knowns); fmincon(Jfun , InitialGue...

How can i write optimal control objective with fmincon?

Same as any objective... Knowns=[lambda1,lambda2]; Jfun=@(Unknowns) objective(Unknowns,Knowns); fmincon(Jfun , InitialGue...

9 days ago | 0

| accepted

Answered

linprog says 'no feasible solution found' even though there is one

Here's another way you could solve it: if rank(xAeq)==num_edges weightsOptimal=xAeq\xbeq; ...

linprog says 'no feasible solution found' even though there is one

Here's another way you could solve it: if rank(xAeq)==num_edges weightsOptimal=xAeq\xbeq; ...

9 days ago | 0

Answered

What starting point to choose so fsolve always returns a solution when any exists?

Can I choose such a starting point so that fsolve will always find a solution if there is any? Maybe the center of the circle/sp...

What starting point to choose so fsolve always returns a solution when any exists?

Can I choose such a starting point so that fsolve will always find a solution if there is any? Maybe the center of the circle/sp...

9 days ago | 1

Answered

How to determine unknown value from an equation

It's a cubic polynomial, so you can use roots().

How to determine unknown value from an equation

It's a cubic polynomial, so you can use roots().

10 days ago | 1

| accepted

Answered

linprog says 'no feasible solution found' even though there is one

Basically, the problem is that your equality constraint matrix xAeq is full rank: >> rank(xAeq) ans = 8 >> cond(x...

linprog says 'no feasible solution found' even though there is one

Basically, the problem is that your equality constraint matrix xAeq is full rank: >> rank(xAeq) ans = 8 >> cond(x...

10 days ago | 1

| accepted

Answered

Which is the best optimization method for optimizing over probability mass functions?

fmincon is most appropriate because your objective is non-linear and non-quadratic. However, your constraints are all linear, so...

Which is the best optimization method for optimizing over probability mass functions?

fmincon is most appropriate because your objective is non-linear and non-quadratic. However, your constraints are all linear, so...

10 days ago | 0

| accepted

Answered

Optimization of 9 unknown with 9 nonlinear constraints by fmincom

It seems highly likely that your problem is over-constrained. With 9 equality constraints and 9 unknowns, you may have enough eq...

Optimization of 9 unknown with 9 nonlinear constraints by fmincom

It seems highly likely that your problem is over-constrained. With 9 equality constraints and 9 unknowns, you may have enough eq...

10 days ago | 1

Answered

How to interpolate ‘z’ for one value of ‘x’ but multiple values of y?

If an interpolation result is giving you NaN, it normally means you are interpolating at a location which is outside the area co...

How to interpolate ‘z’ for one value of ‘x’ but multiple values of y?

If an interpolation result is giving you NaN, it normally means you are interpolating at a location which is outside the area co...

11 days ago | 0

| accepted