Answered

How to plot Intensity profile along the vertical line of an image

y = [0 size(I,1)]; x = [size(I,2)/2 size(I,2)/2];

How to plot Intensity profile along the vertical line of an image

y = [0 size(I,1)]; x = [size(I,2)/2 size(I,2)/2];

13 days ago | 0

| accepted

Answered

Find first three numbers in a matrix that satisfy the condition x>0.001

B=find(A(:,1)>0.001,3)

Find first three numbers in a matrix that satisfy the condition x>0.001

B=find(A(:,1)>0.001,3)

14 days ago | 0

| accepted

Answered

Why do I get no solution found in Fsolve despite the results match my nonlinear equations ?

You're asking for guesses? Because you are not plugging the solution into the same equations that were given to fsolve. fsolve t...

Why do I get no solution found in Fsolve despite the results match my nonlinear equations ?

You're asking for guesses? Because you are not plugging the solution into the same equations that were given to fsolve. fsolve t...

16 days ago | 1

| accepted

Answered

Export residuals from curve fitting

Instead of using cftool, use the fit() command, [fitobject,gof,output] = fit(x,y,'poly1','Weights', w); residuals=output.res...

Export residuals from curve fitting

Instead of using cftool, use the fit() command, [fitobject,gof,output] = fit(x,y,'poly1','Weights', w); residuals=output.res...

16 days ago | 0

| accepted

Answered

Export residuals from curve fitting

For a simple 1 degree polynomial, why not just use polyfit? p=polyfit(x,y,1); residuals=polyval(p,x)-y;

Export residuals from curve fitting

For a simple 1 degree polynomial, why not just use polyfit? p=polyfit(x,y,1); residuals=polyval(p,x)-y;

16 days ago | 0

Answered

error using fminbnd with multiple objective function

A few problems fminbnd cannot minimize functions of more than one unknown variable All Matlab minimization routines e.g. fmins...

error using fminbnd with multiple objective function

A few problems fminbnd cannot minimize functions of more than one unknown variable All Matlab minimization routines e.g. fmins...

17 days ago | 1

Answered

How can I NOT specify the constraint function in the ga function?

Any of the constraint arguments can be left empty to signify to ga that there are no constraints of that type, e.g., x = ga(fun...

How can I NOT specify the constraint function in the ga function?

Any of the constraint arguments can be left empty to signify to ga that there are no constraints of that type, e.g., x = ga(fun...

17 days ago | 1

Answered

alpha shape vs convex hull volume value

Because the convex hull and an alpha shape are not necessarily the same shape. The alpha shape, in particular, depends on the al...

alpha shape vs convex hull volume value

Because the convex hull and an alpha shape are not necessarily the same shape. The alpha shape, in particular, depends on the al...

17 days ago | 0

Answered

How do I calculate the numerical Jacobian for a set of six non linear equations ?

Jac=nan(3,3); %pre-allocate Jac(1,:) = 2*[ x(1)-h1 , x(2)-v1 , x(3)-w1 ]; Jac(2,:) = 2*[ x(1)-h2 , x(2)-v2 , x...

How do I calculate the numerical Jacobian for a set of six non linear equations ?

Jac=nan(3,3); %pre-allocate Jac(1,:) = 2*[ x(1)-h1 , x(2)-v1 , x(3)-w1 ]; Jac(2,:) = 2*[ x(1)-h2 , x(2)-v2 , x...

17 days ago | 1

| accepted

Answered

How to loop a objective function using the optimization toolbox?

My objective function is built on the decision variable so that the objective function is for one time period as well. You cann...

How to loop a objective function using the optimization toolbox?

My objective function is built on the decision variable so that the objective function is for one time period as well. You cann...

17 days ago | 0

| accepted

Answered

Converged to an infeasible point. fmincon stopped because the size of the current step is less than the default value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance.

There are no feasible solutions to your problem because it is impossible to satisfy the first equality constraint, zeros(1,leng...

Converged to an infeasible point. fmincon stopped because the size of the current step is less than the default value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance.

There are no feasible solutions to your problem because it is impossible to satisfy the first equality constraint, zeros(1,leng...

18 days ago | 0

| accepted

Answered

Calling variables into objective function

There is, but the far better way is to use anonymous or nested functions, as covered here https://www.mathworks.com/help/optim/...

Calling variables into objective function

There is, but the far better way is to use anonymous or nested functions, as covered here https://www.mathworks.com/help/optim/...

18 days ago | 0

Answered

Issues about Using Function 'fmincon' solve Optimization Problem

tol = 1.0E-13; This is an incredibly tight tolerance - possibly at the limit of double float precision, depending on the order ...

Issues about Using Function 'fmincon' solve Optimization Problem

tol = 1.0E-13; This is an incredibly tight tolerance - possibly at the limit of double float precision, depending on the order ...

18 days ago | 0

| accepted

Answered

Curve Fitting (polynomial fitting and interpolation)

fit() will return a fitobject, which you can use to evaluate the surface at any point you wish zq=fitobject(xq,yq) It's import...

Curve Fitting (polynomial fitting and interpolation)

fit() will return a fitobject, which you can use to evaluate the surface at any point you wish zq=fitobject(xq,yq) It's import...

18 days ago | 0

Answered

How to sum over 3 dimensional cell array, where each cell also contains cells?

I'm tempted to ask how this data got to be a cell array, when it should really have been a 3x6x6x645 numeric array. We can fix t...

How to sum over 3 dimensional cell array, where each cell also contains cells?

I'm tempted to ask how this data got to be a cell array, when it should really have been a 3x6x6x645 numeric array. We can fix t...

18 days ago | 0

| accepted

Answered

How can in find minimum gradient path with respect to the reference point in a text image?

You can use bwskel or bwmorph('thin',...) to do the skeletonization. If you are already using this, I don't know why it would be...

How can in find minimum gradient path with respect to the reference point in a text image?

You can use bwskel or bwmorph('thin',...) to do the skeletonization. If you are already using this, I don't know why it would be...

18 days ago | 0

Answered

How to generate an array of Hankel and Toeplitz from a defined array?

A = 1 22 3 4 23 32 11 10 55 88 63 3 4 8 10 5 >> ...

How to generate an array of Hankel and Toeplitz from a defined array?

A = 1 22 3 4 23 32 11 10 55 88 63 3 4 8 10 5 >> ...

18 days ago | 0

| accepted

Answered

How to check whether a vector belongs to a matrix?

Psteps=[P_1(1:end-1);P_1(2:end)].'; Q=ismember(N,Psteps,'rows').'

How to check whether a vector belongs to a matrix?

Psteps=[P_1(1:end-1);P_1(2:end)].'; Q=ismember(N,Psteps,'rows').'

20 days ago | 0

| accepted

Answered

How to replace my optimset with equivalent optimoptions ?

Why not just, options = optimoptions(@fsolve, 'Display','iter','MaxFunEvals',1e6,'MaxIter',1e6,... 'Tol...

How to replace my optimset with equivalent optimoptions ?

Why not just, options = optimoptions(@fsolve, 'Display','iter','MaxFunEvals',1e6,'MaxIter',1e6,... 'Tol...

20 days ago | 1

| accepted

Answered

determine all cells are non-zero within a matrix

Your second if statement is correct, and I get the correct output (none).

determine all cells are non-zero within a matrix

Your second if statement is correct, and I get the correct output (none).

20 days ago | 0

| accepted

Answered

How to make a matrix compose by seperate optimization variables

This works fine, once you remove the quotes >> zij=[z1,z2,z3; z2,z2,z3; z3,z3,z3]; >> showexpr(zij) (1, 1) z1 (2, ...

How to make a matrix compose by seperate optimization variables

This works fine, once you remove the quotes >> zij=[z1,z2,z3; z2,z2,z3; z3,z3,z3]; >> showexpr(zij) (1, 1) z1 (2, ...

20 days ago | 0

| accepted

Answered

Point Spread function and optical transfer function.

OTF is the Fourier transform of the PSF. https://en.wikipedia.org/wiki/Optical_transfer_function

Point Spread function and optical transfer function.

OTF is the Fourier transform of the PSF. https://en.wikipedia.org/wiki/Optical_transfer_function

20 days ago | 0

Answered

How can I vectorize this function with nested FOR loop?

Using mat2tiles chunksize=10000; Lc=mat2tiles(L.',[chunksize,24]); normL=mat2tiles(vecnorm(L,2,1), [1, chunksize]); N=nu...

How can I vectorize this function with nested FOR loop?

Using mat2tiles chunksize=10000; Lc=mat2tiles(L.',[chunksize,24]); normL=mat2tiles(vecnorm(L,2,1), [1, chunksize]); N=nu...

21 days ago | 0

| accepted

Answered

Do logarithm to complex number get strange result.

Because for any integer, k, and so clearly log() cannot uniquely determine what the imaginary part of the...

Do logarithm to complex number get strange result.

Because for any integer, k, and so clearly log() cannot uniquely determine what the imaginary part of the...

21 days ago | 0

| accepted

Answered

Complex eigenvalues for hermitian matrix

I suspect it is because you lack the float precision with which to crunch those huge integers in your expressions, like 17373258...

Complex eigenvalues for hermitian matrix

I suspect it is because you lack the float precision with which to crunch those huge integers in your expressions, like 17373258...

22 days ago | 0

| accepted

Answered

Global minima of quadratic forms

Analytically, you could solve this by transforming the problem as follows, f(x) = 0.639*0.5^2*(2*x1 + x2)^2+0.7601*x2^2 =...

Global minima of quadratic forms

Analytically, you could solve this by transforming the problem as follows, f(x) = 0.639*0.5^2*(2*x1 + x2)^2+0.7601*x2^2 =...

22 days ago | 0

Answered

Global minima of quadratic forms

If you want to solve it numerically, you probably have to use ga(). It's the only Matlab solver that supports non-linear integer...

Global minima of quadratic forms

If you want to solve it numerically, you probably have to use ga(). It's the only Matlab solver that supports non-linear integer...

22 days ago | 0

Answered

How to pass a struct as name-value-pairs to a function?

Some functions may enable this (in particular, those that use inputParser to parse string-value pairs will always accept a struc...

How to pass a struct as name-value-pairs to a function?

Some functions may enable this (in particular, those that use inputParser to parse string-value pairs will always accept a struc...

22 days ago | 2

| accepted

Answered

How to find maxima and minima of a column matrix without using findpeaks ?

d=conv( [A(1); A(:); A(end)], [1 ;-2 ;1], 'valid'); saddles=find(d==0) maxs=find(d>0) mins=find(d<0)

How to find maxima and minima of a column matrix without using findpeaks ?

d=conv( [A(1); A(:); A(end)], [1 ;-2 ;1], 'valid'); saddles=find(d==0) maxs=find(d>0) mins=find(d<0)

22 days ago | 2

| accepted

Answered

Count the adjacent same elements in a vector

L=cumsum([1, diff(A)~=0]); B=splitapply(@sum,ones(size(A)),L) C=splitapply(@min,A,L)

Count the adjacent same elements in a vector

L=cumsum([1, diff(A)~=0]); B=splitapply(@sum,ones(size(A)),L) C=splitapply(@min,A,L)

22 days ago | 0

| accepted