Answered
Select a row and append it at the end of a matrix | Move a selected row to end of matrix
H=[1 0 0 1 0 1 0 0 1 1 1 0 1 1 0 1 0 1 0 1 0 0 1 1]; rows2...

6 years ago | 0

| accepted

Answered
Count number of smaller than the threshold in the certain rows of cell arrays
sum(cell2mat(CELL)<-0.5,1).'

6 years ago | 1

| accepted

Answered
Rearrange a matrix by the values of the first column
load(websave('question.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/464105/question.mat')); G=findgro...

6 years ago | 0

| accepted

Answered
How to average along all permutations of a 4D array?
Why not as follows? assert( all(size(A)==size(A,1) ) & ndims(A)==4 , 'A must be NxNxNxN') p=perms(1:4); B=0; for i=1:2...

6 years ago | 0

| accepted

Answered
Getting rid of IntCon in GA
If x(2) is no longer constrained to be an integer, it becomes possible for the denominator sin(x(2)) to be 0, depending on the b...

6 years ago | 0

Answered
evaluating a function which is stored in a variable
Here's one way. It will work whether f1, f2 are anonymous or symbolic. multiply = @(x,y) f1(x,y).*f2(x,y) g=@(y) multiply(...

6 years ago | 0

Answered
Global search optimization error
The fix, for your posted example, is to do, problem = createOptimProblem('fmincon','x0',[-1,2],... 'objective',@(p) sixmin...

6 years ago | 0

| accepted

Answered
roots() function does not give exact roots
double(roots( sym([1 -3 3 -1] ))) == [1;1;1] %all true

6 years ago | 0

Answered
Find real positive roots of 9th order polynomial
The roots of a polynomial become increasingly sensitive to small variations in the polynomial coefficients as the order of the p...

6 years ago | 0

Answered
Problem using ifft and fft
Make sure you are familiar with the concepts here, https://www.mathworks.com/help/signal/ug/linear-and-circular-convolution.htm...

6 years ago | 0

Answered
Solving system of integral equations - Error FSOLVE cannot continue
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. Before you use FSOLVE, you must make su...

6 years ago | 0

| accepted

Answered
Could you help me interpret what happened?
obj.V is a Dependent property.

6 years ago | 1

| accepted

Answered
How to add a constraint when using fsolve?
The fifth equation involves only x(3) and can be solved immediately x3=(2*48/0.001)^(1/3) The 3rd and 4th equations then imply...

6 years ago | 1

Answered
Connected components in a graph
M=[1 2;2 5;3 4;4 6;6 7;6 8;6 9;6 10]; G=graph(M(:,1),M(:,2)); [bins,binsizes]=conncomp(G); idx=[2,1]; binsizes=binsizes(...

6 years ago | 1

| accepted

Answered
Function for Dynamic Programming for Global optimization
Any code people are willing to share would be on the File Exchange, e.g., https://www.mathworks.com/matlabcentral/fileexchange?...

6 years ago | 0

Answered
Empty for loop matrix
I would rewrite the loop as follows, for iyr = 1:nyrs k= mat(:,1)>=startyear(iyr) & mat(:,1)<=endyear(iyr); ...

6 years ago | 0

Answered
Error with matrix multiplication?
Yep, it should work, as the following example shows. I would check to make sure the matrix dimensions are really what you think ...

6 years ago | 0

Answered
Fast product of large matrices
If see about a 25% speed-up when done as B=AT*(x.*A), N=2^18; A=rand(N,500); AT=A.'; x=rand(N,1); tic; B=AT*spdiags(x,0,...

6 years ago | 1

Answered
How long does it take MATLAB to process my license?
There's definitely something anomolous with your installation. I've never seen a case where one didn't get immediate access to ...

6 years ago | 0

Answered
levernberg-marquadt method
dr = [t.^0, E.*t.^(x(3)), E.*x(2).*log(t).*t.^(x(3)), -E.*x(2).*t.^(x(3)+1)];

6 years ago | 0

Answered
How to substract hand only from the input rgb images?
You can use imfreehand() or Freehand() to draw the boundary of the palm interactively and then mask out everything in the backgr...

6 years ago | 1

Answered
Function to store values??
You wouldn't do it with a loop. There's a command for it, result = randi(100,1,5)

6 years ago | 0

Answered
How do I iterate over vector elements, but ignore elements which do not meet a condition?
Using interpMatrix from the File Exchange, https://www.mathworks.com/matlabcentral/fileexchange/26292-regular-control-point-int...

6 years ago | 0

Answered
How do I iterate over vector elements, but ignore elements which do not meet a condition?
z=zeros(1,deadTime); for det = find(detect_vec); result((det+1):(det+deadTime), m0, h) = z; end

6 years ago | 1

| accepted

Answered
How do I iterate over vector elements, but ignore elements which do not meet a condition?
e=zeros(1,deadTime); I=conv( double(detect_vec~=0), [e+1,0,e] , 'same')>0; result(I, m0, h)=0;

6 years ago | 0

Answered
Not enough input arguments.
You should believe what the error message is telling you. In the documentation for repmat, you will find no single-argument synt...

6 years ago | 0

Answered
Referencing and extracting with conditions
N=size(parts,1); result=cell(N,1); for i=1:N rows=all(combomatrix<=parts(i,:),2); result{i}=combomat...

6 years ago | 0

Answered
how do i solve a system of equasion with mulitple variables
syms c1 c3 c4 m1 m2 h1 h2 v equ1 = c1==m2*c3/m1; equ2 = c3==(v-c4)/(h1+h2); equ3 = c4==c1*h1-c3*h1; sol = solve([equ1,equ2...

6 years ago | 0

| accepted

Answered
Is hyperparameters the same as optimal parameters?
Hyperparameters are settings used by the learning algorithm. They do not include the unknowns of interest in the system you are ...

6 years ago | 0

Answered
How to solve the below equations for unknowns with equal and inequality constraints?
Since your equations and constraints are linear, lsqlin is applicable, https://www.mathworks.com/help/optim/ug/lsqlin.html

6 years ago | 0

Load more