I don't see any mistakes (that's why posting your error messages and output is always a good thing), however, the whole thing ca...

8 Tage ago | 0

How to find the indices that a point lays between?
Do you suggest another way? In case X is not increasing. If X,Y are non-monotonic, I would do [~,points] = pdist2([X(:),Y(:)],...

8 Tage ago | 1

How to find the indices that a point lays between?
find is inefficient. You should instead do, point1=discretize(xA,X); point2=point1+1;

8 Tage ago | 0

Split array into multiple columns based on another array
result = splitapply(@(x) {x}, DHB_combine,index_combine);

8 Tage ago | 0

how to plot a fitness or objective function with optimum values
Sounds like you want this? options = optimoptions('ga','PlotFcn',{'gaplotbestf','gaplotbestindiv'}); [x,fval] = ga(Objective...

8 Tage ago | 0

Multi-objective optimisation using results from external simulation
MATLAB optimization solvers require that you provide a function which take a guess of your unknowns as input and return the quan...

8 Tage ago | 1

Subset multidimensional array using a vector
idx=repmat({':'},1,ndims(A)); idx(1:numel(v))=num2cell(v); result=A(idx{:});

8 Tage ago | 1

Sorting and averaging matrices
[~,idx]=sort( reshape(A,8,[]) ,1); [m,n]=size(idx); C=reshape(B,m,n,[]); [m,n,p]=size(C); idx=i...

8 Tage ago | 2

| accepted

fmincon command to find minimum value of Rosenbrock's function in Polygonal domain
You have miscalculated your A and b. You can use vert2lcon to obtain them automatically, https://www.mathworks.com/matlabcentra...

9 Tage ago | 0

| accepted

Action shot function with multiple images
Yes, here is an approach that uses no loops, Image4D=double(cat(4,ImageCell{:})); MedianImage = median(Image4D,4); [~,idx...

10 Tage ago | 3

| accepted

Undefined function for input arguments of type 'double': how do I make them vectors and not doubles?
Here is the non-symbolic approach mentioned by Adam. function[val,g,H]=givenfGNM(x) %givenf() modified to output the Hessian a...

10 Tage ago | 1

Removing object from image using median filter
I'll call your 1xn cell array of images ImageCell. Then I think you want, Image4D=cat(4,ImageCell{:}); R=median( Image4D(:,:...

10 Tage ago | 2

| accepted

Avoiding local minimum with fmincon
So my question is: Is there any way to avoid local minimum using fmincon or fminunc? There is no systematic, problem-independen...

10 Tage ago | 2

Could anyone help me how to solve the issue.
[m,n]=size(a); differences=reshape(a,m,1,n) - reshape(a,1,m,n);

12 Tage ago | 1

| accepted

which way to call function is better?
I have more than hundred of input parameters in myfunc and I am using the following way to call the function after grouping the ...

12 Tage ago | 0

fmincon gradient of nonlinear inequality constraints must have size???
What is mysterious about the error message? It has told you that your gradc output has to be 4x12 and in your NLC2 you clearly o...

12 Tage ago | 0

What is the best way to store groups of 3 nearest non-zero pixels?
I would like to identify and store each set of 3 closest points (as seen in the attached image) in a separate variable. No, you...

12 Tage ago | 0

| accepted

matrix multiplication for "3-D" matrices
result=nan(2,2,100); result(1,1,:)=a11.*b11 + a12.*b21; result(1,2,:)=a11.*b12 + a12.*b22; result(2,1,:)=a21.*b11 + a22.*b2...

12 Tage ago | 0

| accepted

More than 580 billion possibilities
Sure, for example, count=0; for i=1:580*1e9 possibility=rand; if possibility>0.5 count=count+1...

12 Tage ago | 0

| accepted

GPU optimization of looped vector operations
This modification uses mat2tiles from the File Exchange, to help divide the computation into bigger, vectorized chunks https://...

13 Tage ago | 1

| accepted

Programatically creating an anonymous function that separates "Variables" and "Parameters"
I just wanted to mention that a generic simplifier like what you have asked for will not normally give you the best performance....

13 Tage ago | 0

How can i fit the data to the custom equation without using Curve fitting Toolbox ?
FMINSPLEAS will work well for this problem. It uses fminsearch, but in a savvy way that reduces the problem to only 2 unknowns. ...

13 Tage ago | 1

| accepted

FMINCON: Interior-Point algo -> Is there a way to pass extra parameters to the hessian function or allow the objective function to return 3 output variables (function value, gradient and hessian) when there are no nonlinear constraints?
Also, even if my hessian could be computed solely using 'x', this approach would not be ideal - computing the hessian requires c...

13 Tage ago | 0

| accepted

I'm trying to crop a circle from an image using imfindcircle... but It deosn't work. what is the issue ?
Swap the coordinates in the output of imfindcircles. [xx,yy] = ndgrid((1:imagesize(1))-centers(2),(1:imagesize(2))-centers(1));...

13 Tage ago | 0

| accepted

Matlab Curve Fitting Algorithm
If you didn't specify any lower/upper bounds in the fitoptions, then the 'poly11' fitting task has the form of an unconstrained ...

14 Tage ago | 1

| accepted

Weighted linear combination between vectors
weights=[1 2 3 4]; C=W*weights(:);

15 Tage ago | 1

| accepted

how to define binary decision variable in multi objective optimization (gamultiobj) problem
There must be a reason why integer constraints are not supported, but you could try to enforce binariness through non-linear equ...

15 Tage ago | 0

Erro in calling function in fsolve that has conditional operators
Change these two lines, %F1=ferror(x2d,x2n) Error=fsolve(@(x2) ferror(x2d,x2n,x2),0) Also, make sure to pass all variables th...

15 Tage ago | 0

| accepted