5,428 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

Generating a matrix based on an equation with conditions

For example, >> A=zeros(10,1); A(1:5)=4; A(6:10)=3 A = 4 4 4 4 4 3 3 3 ...

Generating a matrix based on an equation with conditions

For example, >> A=zeros(10,1); A(1:5)=4; A(6:10)=3 A = 4 4 4 4 4 3 3 3 ...

19 hours ago | 1

| accepted

Answered

Create an accurate boundary around 2D point cloud horizontal plane

You can use alphaShape.

Create an accurate boundary around 2D point cloud horizontal plane

You can use alphaShape.

21 hours ago | 0

Answered

Interpolating a 3D Matrix using interp1

Using my KronProd class (Download) m=14; p=221; A = rand(m,m,p) ; M=40; %new XY dimension B=interp1(eye(m),linspace(1,m,M),...

Interpolating a 3D Matrix using interp1

Using my KronProd class (Download) m=14; p=221; A = rand(m,m,p) ; M=40; %new XY dimension B=interp1(eye(m),linspace(1,m,M),...

1 day ago | 0

Answered

Can I use Optimization tool like fmincon or ga etc if I have constraint optimization problem that optimization variable cannot be within a range inside upper and lower limit?

Example : suppose I am solving an optimization problem where x should be within 1 and 10 or 29 and 99. The feasible space for x...

Can I use Optimization tool like fmincon or ga etc if I have constraint optimization problem that optimization variable cannot be within a range inside upper and lower limit?

Example : suppose I am solving an optimization problem where x should be within 1 and 10 or 29 and 99. The feasible space for x...

1 day ago | 0

| accepted

Answered

Finding a pixel location after imrotate

Well, the center of the image in your example is at c=[512.5;340]; and the rotation matrix expressing the rotation is R=[cosd...

Finding a pixel location after imrotate

Well, the center of the image in your example is at c=[512.5;340]; and the rotation matrix expressing the rotation is R=[cosd...

1 day ago | 1

| accepted

Answered

Adding constraints to lsq fitting

Any chance you could modify the code without the weighting function and with the new data? Note that this means rdf_contact and ...

Adding constraints to lsq fitting

Any chance you could modify the code without the weighting function and with the new data? Note that this means rdf_contact and ...

2 days ago | 0

Answered

Adding constraints to lsq fitting

Here is an adaptation of the algebraic solution that I presented in your previous thread. I don't bother with the lsqcurvefit a...

Adding constraints to lsq fitting

Here is an adaptation of the algebraic solution that I presented in your previous thread. I don't bother with the lsqcurvefit a...

3 days ago | 2

Answered

initlalize several variables at once

Just to sum things up here, below is my implementation of the fit, combining all my various recommendations. Both the algebraic ...

initlalize several variables at once

Just to sum things up here, below is my implementation of the fit, combining all my various recommendations. Both the algebraic ...

3 days ago | 0

Answered

initlalize several variables at once

One other thing I would point out is the model function you have shown us here is linear in the coefficients. This means that it...

initlalize several variables at once

One other thing I would point out is the model function you have shown us here is linear in the coefficients. This means that it...

3 days ago | 1

Answered

How to automatically constrain some of the unknown values in an optimization problem?

I will assume you have some binary vector v which indicates the groupings of the variables, so for example this, [0 0 x(1) x(2)...

How to automatically constrain some of the unknown values in an optimization problem?

I will assume you have some binary vector v which indicates the groupings of the variables, so for example this, [0 0 x(1) x(2)...

3 days ago | 1

Answered

initlalize several variables at once

Is there a way to more easily set this, assuming they all have the same initial guess? One way: params0=linspace(0.1,0.1,13) ...

initlalize several variables at once

Is there a way to more easily set this, assuming they all have the same initial guess? One way: params0=linspace(0.1,0.1,13) ...

4 days ago | 1

Answered

initlalize several variables at once

If all you're trying to do is polynomial surface fits of various orders, I would just use the Curve Fitting Toolbox, if you have...

initlalize several variables at once

If all you're trying to do is polynomial surface fits of various orders, I would just use the Curve Fitting Toolbox, if you have...

4 days ago | 1

| accepted

Answered

Replace part of matrix with other matrix.

Z=zeros(2); B=B+cell2mat({Z,A,A1;A2,Z,A3;A,A1,Z})

Replace part of matrix with other matrix.

Z=zeros(2); B=B+cell2mat({Z,A,A1;A2,Z,A3;A,A1,Z})

4 days ago | 1

| accepted

Answered

General Approach to Fitting dozens of curves using the same coefficients

You can use lsqcurvefit to do so, simply by posing the problem as a 30-parameter fit. If you do this, you will want to provide a...

General Approach to Fitting dozens of curves using the same coefficients

You can use lsqcurvefit to do so, simply by posing the problem as a 30-parameter fit. If you do this, you will want to provide a...

5 days ago | 1

| accepted

Answered

Placing values in a matrix with values from another matrix

A(A==1)=B;

Placing values in a matrix with values from another matrix

A(A==1)=B;

5 days ago | 0

| accepted

Answered

Number of elements error

for i = 3:(length(x)-2) ff(i) = (-1*x(i+2)+6*x(i+1)-3*x(i)-2*x(i-1))/(6*dx); L = L + dx*((f(x(...

Number of elements error

for i = 3:(length(x)-2) ff(i) = (-1*x(i+2)+6*x(i+1)-3*x(i)-2*x(i-1))/(6*dx); L = L + dx*((f(x(...

5 days ago | 0

| accepted

Answered

Removing sub matrix from 3d matrix, if any values in the matrix exceed a certain min/max value

discard=any( any( epochs_CG(1:2, :, :)>=100 ,2) ,1); epochs_CG(:,:,discard)=[];

Removing sub matrix from 3d matrix, if any values in the matrix exceed a certain min/max value

discard=any( any( epochs_CG(1:2, :, :)>=100 ,2) ,1); epochs_CG(:,:,discard)=[];

5 days ago | 0

| accepted

Answered

How to replace 2x2 zero sub matrices by different 2x2 matrices ?

basically i want solution in this form x p1 p2 p3 p1 x p2 p3 p1 p2 x p3 p1 p2 p3 x C={zeros(2), p1,p2,p3}; result=B+ce...

How to replace 2x2 zero sub matrices by different 2x2 matrices ?

basically i want solution in this form x p1 p2 p3 p1 x p2 p3 p1 p2 x p3 p1 p2 p3 x C={zeros(2), p1,p2,p3}; result=B+ce...

5 days ago | 0

| accepted

Answered

How to replace 2x2 zero sub matrices by different 2x2 matrices ?

Here is a simple example, but the right hand side can be any array with an appropriate number of elements B(B==0)=1:48;

How to replace 2x2 zero sub matrices by different 2x2 matrices ?

Here is a simple example, but the right hand side can be any array with an appropriate number of elements B(B==0)=1:48;

5 days ago | 0

Answered

Plotting subplot with two concurrent plots

figure; for k = 1:5 subplot(2,5,k); [val,loca]=(max(abs(squeeze(S(1,k,:,:))))); plot(T,squeeze(abs(S(1,k,92,:))),T,squeeze...

Plotting subplot with two concurrent plots

figure; for k = 1:5 subplot(2,5,k); [val,loca]=(max(abs(squeeze(S(1,k,:,:))))); plot(T,squeeze(abs(S(1,k,92,:))),T,squeeze...

5 days ago | 0

| accepted

Answered

How to use blkdiag command to create a matrix such that its diagonal blocks are random 2 x 2 matrices?

Acell=mat2cell(rand(8,2), ones(1,4)*2,2) B=blkdiag(Acell{:})

How to use blkdiag command to create a matrix such that its diagonal blocks are random 2 x 2 matrices?

Acell=mat2cell(rand(8,2), ones(1,4)*2,2) B=blkdiag(Acell{:})

5 days ago | 0

| accepted

Answered

Not quite fitting the data using lsqcurvefit

When your model function is fully vectorized, as suggested by Walter, the results are better, but only you can know for sure wha...

Not quite fitting the data using lsqcurvefit

When your model function is fully vectorized, as suggested by Walter, the results are better, but only you can know for sure wha...

6 days ago | 0

| accepted

Answered

Defining array contents - order doesn't matter - Linear programming problem

It does not matter what order the B(i) are in, as long as the ordering of the rows A(i,;) matches B(i).

Defining array contents - order doesn't matter - Linear programming problem

It does not matter what order the B(i) are in, as long as the ordering of the rows A(i,;) matches B(i).

8 days ago | 0

Answered

How to split array in n part every m points ?

I don't know of any built-in function that will do that, but it is easy to implement: function B=foo(A,p,r) N=numel(A); ...

How to split array in n part every m points ?

I don't know of any built-in function that will do that, but it is easy to implement: function B=foo(A,p,r) N=numel(A); ...

8 days ago | 2

| accepted

Answered

Hgtransform and makehgtform at fsurf

If the cone has the orientation you want, but not the location , you can add a translation to put it where you want, set(t,'Mat...

Hgtransform and makehgtform at fsurf

If the cone has the orientation you want, but not the location , you can add a translation to put it where you want, set(t,'Mat...

8 days ago | 0

| accepted

Answered

How do I use a AVERAGEIFS statement of excel within a range for multiple data of irregular intervals in matlab?

Something like this would do it, groups=discretize(altitudes,ranges); averages=splitapply(@mean, temperature,groups);

How do I use a AVERAGEIFS statement of excel within a range for multiple data of irregular intervals in matlab?

Something like this would do it, groups=discretize(altitudes,ranges); averages=splitapply(@mean, temperature,groups);

8 days ago | 0

Answered

Improving LSQCcurvefit solutions through improving x0 through loops

I can see that your model function derives in some way from the quadratic formula, but I can't quite see where all the pieces ar...

Improving LSQCcurvefit solutions through improving x0 through loops

I can see that your model function derives in some way from the quadratic formula, but I can't quite see where all the pieces ar...

10 days ago | 0