Answered
How to implement theses constraints in the cost function ?
pso() doesn't have an input for such constraints. Maybe use ga() or patternsearch(). Here's how it would look when solved with ...

4 years ago | 0

Answered
Incorrect table size, unsure why.
It's not clear what the sizes of all the given variables in your code are. However, to divide a matrix into BINx1 strips and ave...

4 years ago | 0

| accepted

Answered
Multiply 3x3 and 3x1 vectors in a loop
Might be what you want: calc=V1*load('vectors.mat').vv

4 years ago | 0

Answered
How to append Struct?
One way: ABC.x=1; ABC.y=2; ABC.z=3; DEF.p=10; DEF.q=20; GHI.m=100; GHI.n=200; args=[namedargs2cell(ABC), namedar...

4 years ago | 0

| accepted

Answered
What matrix to use to estimate homography matrix in planar homography
H=reshape(V(:,end),3,3);

4 years ago | 0

| accepted

Answered
What does line number 4 is actually doing, i.e. obj = obj@CtrlAffineSys(params);
It is calling the parent class constructor.

4 years ago | 0

| accepted

Answered
Reversing an array within smaller subsets
A=1:60; reshape( flipud(reshape(A,5,[])) ,1,[])

4 years ago | 0

| accepted

Answered
array element not equal to equivalent double
Because computers cannot do exact math. The difference between x and y beyond the 4th decimal place make this clear: array=0.00...

4 years ago | 1

| accepted

Answered
Even and odd part of function
syms t y = symfun( piecewise(1 < t < 3, t-1, 0) ,t); yeven=(y(t)+y(-t))/2 fplot(yeven) and similarly for the odd part.

4 years ago | 1

| accepted

Answered
How do I ensure a circle drawn on an image is at the proper location?
Keep in mind the intrinsic coordinate system of the Image Processing Toolbox, a(eraseY,eraseX) = 0;

4 years ago | 1

| accepted

Answered
Scan image row-wise and store index of minimum grey values.
I = imread('5.bmp'); I = im2gray(I); min_intensity= min(I,[],2); [row,col]=find(I==min_intensity); %indices of minimum

4 years ago | 0

| accepted

Answered
Exporting Curves from Curve Fit tool to workspace and plotting on the same graph
There' s no information in your post about how fittedmodel1--4 were obtained, but I speculate that it would be something like th...

4 years ago | 0

| accepted

Answered
Custom exponential fit doesn't seem to work
It would be better to parametrize the function as xmin=min(x) f=@(x)a*exp(-b.*(x-xmin))+c; The fit is better conditioned t...

4 years ago | 0

Answered
Custom exponential fit doesn't seem to work
Is there a way to automatically find more appropriate initial guesses? Use fminspleas from the File Exchange. Then you only ne...

4 years ago | 1

| accepted

Answered
Finding neighbours of links in a graph
See neighbors.

4 years ago | 0

Answered
Root Finding with False Position Method
Hint: Given two points (a,f(a)) and (b,f(b)), one way to find the next point c is, c=roots( polyfit( [a,b], [f(a),f(b)] , 1)...

4 years ago | 0

Answered
Automatically update class properties
See this recent, related thread, https://www.mathworks.com/matlabcentral/answers/1845488-set-methods-for-two-interdependent-pro...

4 years ago | 0

| accepted

Answered
How do I average values in a vector that share a common value in another vector?
splitapply(@mean, Meas, findgroups(ID))

4 years ago | 0

| accepted

Answered
Matrix moving mean with overflow average
Here's one way. I assumed here you want the same wrap-around to occur in the lower-right corner of the matrix as well. A=reshap...

4 years ago | 1

| accepted

Answered
solving a root equation
There don't appear to be any non-complex solutions x=roots([1/20 zeros(1,8) -2 0 -1 100]).^4

4 years ago | 0

Answered
How can i find solid cone center of mass?
https://byjus.com/jee/centre-of-mass-of-a-solid-cone/

4 years ago | 1

Answered
256x256x6 exp decaying data
I feel like there is a lot of missing detail in the question, but here is one fulfillment of what it asks for: out = exp(-sort(...

4 years ago | 0

Answered
solving nonlinear equation including max function
Reorganizing the equations into the form A*x<=b, Aeq*x=beq and using this FEX download, https://www.mathworks.com/matlabcentral...

4 years ago | 0

Answered
Centre X-Y data so that the highest value of Ys is at the centre of X. And then average the curve to fit into gaussian.
Using gaussfitn from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/69116-gaussfitn you can do a sim...

4 years ago | 0

| accepted

Answered
Centre X-Y data so that the highest value of Ys is at the centre of X. And then average the curve to fit into gaussian.
I think it would be better just to fit a gaussian (e.g. using fit) to each pair (X,Y(:,i)). Then the fitted mean in each column ...

4 years ago | 0

Answered
Call on function that takes in 2 variables multiple times
You can hide the loop with arrayfun, but it won't speed things up. output_vectors = cell2mat(arrayfun(@(i) {example_func(input_...

4 years ago | 0

| accepted

Answered
Function lsqlin smooth results
You could add smoothing penalties on first differences to your lsqlin data. Assuming your signal is of length n, this would look...

4 years ago | 1

| accepted

Answered
inpolygon usage with big matrices or faster function
Is it a convex polygon? There are much faster alternatives to inpolygon for convex polygons,e.g., https://www.mathworks.com/mat...

4 years ago | 0

Answered
How to seperate the circle object from the background.
A=double(load('Image').A); B=rgb2hsv(A); C=bwareafilt(imbinarize(B(:,:,2)),1); mask=imclose(C,strel('disk',15)); imshow(ma...

4 years ago | 0

Answered
Linear indexing over a subset of dimensions
If you are indexing into the initial dimensions of an array, reshape will be cheaper than permute: B = zeros([25 3]); bIdx = [...

4 years ago | 1

| accepted

Load more