How to quickly find the first non-zero element without iterations in all columns in a sparse matrix?
See this FEX submission, https://www.mathworks.com/matlabcentral/fileexchange/24641-vectorized-find-with-first-option

21 days ago | 0

How to quickly find the first non-zero element without iterations in all columns in a sparse matrix?
[~,result]=max(logical(A),[],1);

21 days ago | 0

| accepted

Use fsolve with an elliptic integral
It does not make sense to have a relational expression like, [K, E]== ellipke(m) as one of your equations, expecially one that...

22 days ago | 0

| accepted

Unclassified variables in a parfor loop
parfor i= 1:xyend-xystart+1 .... A = zeros(nx,ny); B = A; for n=1:Nn; for m=1:Mm; ...

23 days ago | 0

| accepted

Submitted

PROB2MATRICES: A selective version of prob2struct
Obtains matrices for select parts of an optimization problem from problem-based description.

Should I trust solutions obtained for a nonlinear non-transcendental equation in matlab using 'fzero' function?
fzero is a numerical root finder. One doesn't expect y(x) to be exactly zero at the roots that it finds, but it should be pretty...

24 days ago | 0

How to Put Objective and Constraints functions in the same function ?
I am working on an optimization problem with non linear inequality constraints and i wish to put the objective and constraints f...

24 days ago | 0

CheckGradient uses central differences, whereas you appear to be using right handed differences. Are you certain that your const...

25 days ago | 0

| accepted

Minimising the summation of distance between two curves by placing the arc at best distance from origin
It's a non-differentiable, one dimensional cost function minimization. I would use fminbnd, https://www.mathworks.com/help/matl...

27 days ago | 0

Calling a class's static method from its metadata
or indeed a better way entirely from what I am proposing to achieve the calling of such an abstract static function on all subcl...

27 days ago | 0

How do I feed data from a non linear constraint function to the objective function when using fmincon?
Since your unknown vector is x, your objective and constraints must be functions of x and nothing else (except known constants w...

27 days ago | 0

and my objectif function is very sensible in a way that if i change one coefficient value by 0.0001, i'll get inf as a results (...

27 days ago | 0

| accepted

Genetic algorithm constraints/optimization toolbox
You need to write your fitness function and all of your constraints in terms of 12 unknowns. The constraint matrices must be wri...

28 days ago | 0

Mathematical formulation of a operations research problem
Should be very easy with the Problem-Based Optimization Workflow.

28 days ago | 1

| accepted

How to find a figure's centroid inside a polyshape?
In fact Matt, anywhere within the limits is already viable for me. If so, you could use nearestvertex command to project the ce...

28 days ago | 1

| accepted

Integral evaluation in an alphashape
Perhaps as follows. Here, shp refers to your alphaShape object. fun=@(x,y,z) (x.^2+y.^2+z.^2).*shp.inShape(x,y,z); range=num...

28 days ago | 0

Max number iterations for tolerance
Call fminsearch with more output arguments to get information about how many iterations it took. x0 = [3,4]; options = optimse...

29 days ago | 0

issue with polyval and polyfit measuring time
xlog = log10(x); tlog = log10(y);

29 days ago | 1

| accepted

How to set two a vector greater than a variable and lower than another variable into a new matrix?
MutCol=randi([aftbod, fwdbod],10,1); aftref=MutCol( aftbod<MutCol & MutCol<midbod); fwdref=MutCol( midbod<MutCol & MutCol<f...

29 days ago | 0

| accepted

How should I fix my convolutional integral
This might be what you want, subplot(1,2,1); ty=t; plot(ty,y,'LineWidth',2); title('y(t)'); %Second function of the convo...

30 days ago | 0

| accepted

Question

Behavior of repmat with user-defined object
I have defined a class which displays, and in many ways behaves, like a table: >> obj obj = A ...

30 days ago | 0 answers | 0

### 0

Sum of all the elements after the matrix diagonal
answer=0; for r = 1:row for c = 1:col if c >= r answer = A(r,c) + answer; end end end...

1 month ago | 1

| accepted

Arrays of Anonymous Functions used in for loop
It is not valid. Here is one way that I might rewrite the code, terms = input('How many terms are there for the loading? '); L...

1 month ago | 0

| accepted

How to constructing a matrix of repeated rows v?
Either of the following would work >> Q=repelem(v,size(A,1),1) >> Q=repmat(v,size(A,1),1) but note that it's not normally s...

1 month ago | 0

| accepted

How do I find the quadratic approximation using this equation?
Consider using this File Exchange tool instead: https://www.mathworks.com/matlabcentral/fileexchange/34765-polyfitn

1 month ago | 0

using fmincon to optimize function including simultaneous equations
These lines are illegal in Matlab. You cannot put a literal number like 0 on the left hand side of an '=', except when working w...

1 month ago | 1

Use pdist() and vertcat() using for loop
X = rand(7,7); n = size(X,2); C=cell(n,1); for i=1:n C{i}=pdist(X(:,i)); end C=cell2mat(C);

1 month ago | 0

| accepted

3-D matrix operations
Another guess, result=convn(RefBlock,[1,1]/2,'valid');

1 month ago | 0

How to determine curve types by matching experimental data to references
You could fit each curve with all the types and see which gives the least residual.

1 month ago | 0