Answered
GA linear constraints problem
I'm not sure why you are using ga() rather than linprog, but for the constraint you describe, the Aeq,beq constraint matrices wo...

3 years ago | 0

Answered
Vectorize Matrix Formation & Multiplication
N=length(t); a=reshape(a,1,1,N); B=zeros(3,3,N) ; B(1,1,:)=1; B(2:3,2:3,:)=[cos(a), sin(a); -si...

3 years ago | 0

| accepted

Answered
Reseting and refresing figure with tiledlayout/nexttitle
One possibility: A(2,2)=60; mtrx_surf(A) A(2,2)=30; mtrx_surf(A) function out = mtrx_surf(Z3) persistent srf ...

3 years ago | 0

| accepted

Answered
Elimination of for loops
L=2; T=1; w0=2*pi; N=3; ts=linspace(0,T,101)'; ts(end)=[]; w=w0+(0:N-1)/T; s=repmat(sum(exp(1j*ts*w) ,2).',1,L);

3 years ago | 0

Answered
Generate a formula from equation
L=3; T=1; w0=2*pi/(T/3); ts=linspace(0,T,101)'; ts(end)=[]; w=w0+(0:L-1)/T; s=reshape( exp(1j*ts*w) ,1,[]); t=lin...

3 years ago | 0

Answered
How can you calculate the change in angle(RotX,RotY,Rotz) of a normal vector (say of that of a flat mirror) to a normal vector of an average plane thru a deformed mirror?
The rotation angles to go from the undeformed to deformed normal vector are calculated. There is no unique rotation that will ...

3 years ago | 0

Answered
How do I fit a regression equation to find coefficients and exponents?
fminspleas from the File Exchange (Download) fared better, but it looks like a highly ill-conditioned data set: load('X_reg.mat...

3 years ago | 0

| accepted

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 ...

3 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...

3 years ago | 0

| accepted

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

3 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...

3 years ago | 0

| accepted

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

3 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.

3 years ago | 0

| accepted

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

3 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...

3 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.

3 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;

3 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

3 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...

3 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...

3 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...

3 years ago | 1

| accepted

Answered
Finding neighbours of links in a graph
See neighbors.

3 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)...

3 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...

3 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))

3 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...

3 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

3 years ago | 0

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

3 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(...

3 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...

3 years ago | 0

Load more