Answered
I need an optimvar to be zero when another optimvar is zero
Impose the constraint w<=x.

4 years ago | 0

Answered
Draw circle in a rectangular
c=nsidedpoly(1000); s=subtract(nsidedpoly(4,'Side',20),c); h=plot([c,s]); axis equal h(1).FaceColor='red'; h(1).FaceAlpha=1;...

4 years ago | 0

Answered
Fast computation of entries of large matrix
x1=rand(2500,5); % some matrix with high number of rows and small number of columns > 1 x2=rand(2400,5); % another matrix w...

4 years ago | 1

| accepted

Answered
element-wise operator to scale rows of matrix with entries of a vector
Also, applies the element-wise operator .* to its left argument (here, A) or to its right argument (here, d)? .* has two operan...

4 years ago | 0

| accepted

Answered
how to pass keyword arguments to a function via a struct
You'll have to go old school and use inputParser. y = struct('a',8,'b', 9); x=examplefn(y) x=examplefn('a',8,'b',9) functi...

4 years ago | 0

Answered
Faster interpolation of 2-D spatial data at different time steps without looping through the time steps?
Using func2mat from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/44669-convert-linear-functions-to-m...

4 years ago | 0

| accepted

Answered
How to replace all row vectors except 1st according to the difference?
two = (two(1,:)-u).*logspace(0,-5,100)' +u;

4 years ago | 1

| accepted

Answered
Find minimum of a generic polynomial
roots(polyder(p)) will find the roots of the derivative of p. You can then evaluate the polynomial at all the roots to see where...

4 years ago | 1

Answered
Translate 3D coordinates on a known surface
This FEX download seems to do what you want. I haven't used it myself, though. https://www.mathworks.com/matlabcentral/fileexch...

4 years ago | 0

| accepted

Answered
How can I calculate unknown roots from a matrix
A = [ 12 22 33 44 ; 49 56 68 79 ; 10 11 12 13 ; 46 58 64 79 ]; B = [15 16 17 18 ; 44 58 67 71 ; ...

4 years ago | 1

| accepted

Answered
how to remove noise from curves and take their derivates
If you provide a StartPoint in your fit options, the warning will go away and the fit will be the same when you rerun. However...

4 years ago | 0

Answered
Im trying to implement the argmax operator in matlab.
fmincon should have been fine. Since you have no constraints, though, fminunc might be better. fminsearch might also be sufficie...

4 years ago | 1

| accepted

Answered
How to sum up multiple cell arrays (column-wise)?
A=load('dummy').dA_dum; B=reshape( cell2mat(A(:).') ,6,6,26,32); result =reshape( num2cell(sum(B,3),[1,2]) ,1,32);

4 years ago | 1

| accepted

Answered
Prove that Cos(4x) = 8cos^4 x - 8cos^2 x + 1
Use simplify. As a similar example, syms x simplify( 1 - 2*sin(x)^2 )

4 years ago | 0

Answered
Limit length of a string
text1='012345678901234567890123456789'; text2='01234567'; text1(19:end)='' text2(19:end)=''

4 years ago | 0

Answered
Is it possible to detect the orientation of a marked ball in an image by comparing it to an according model from a plot?
You can use the Computer VIsion Toolbox command extrinsics if you have it.

4 years ago | 0

Answered
Why I cannot change the class property in this case?
You called setpos() without returning anything. So, you need to have, myobject1 = myobject1.setpos([100, 0, 0]) Or, inherit th...

4 years ago | 0

| accepted

Answered
Solve a multiobjective optimization problem by problem-based approach in Matlab2021a
You can use prob2matrices from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/74481-prob2matrices-a-se...

4 years ago | 1

| accepted

Answered
Translate 3D coordinates on a known surface
[~,I]=pdist2( Nodes_XFix, coord_XMov,'euc','Smallest',1) coord_XMov = Nodes_XFix(I,:);

4 years ago | 1

Answered
how do I filter noise and background objects from images?
Perhaps with bwpropfilt(____,'Eccentricity', range)

4 years ago | 1

Answered
How to find max of each iteration in cell array?
The more natural thing would be to have A be a 20x2xN array to keep track of the N iterations. Then you could simply do, max(A,...

4 years ago | 0

Answered
Returning cropped image on to original image after doing some analysis on that cropped portion
i0=floor(Ymin); j0=floor(Xmin); i1=i0+ceil(Height)-1; j1=j0+ceil(Width)-1; Image(i0:i1,j0:j1)=croppedImage %Put cropp...

4 years ago | 1

| accepted

Answered
Saving images inside a loop with changing filename
I=rand(20,20); [~,fo{1,1},~]=fileparts(pwd); for i=1:10 index=i imwrite(I, fo{1,1} + "_Roi_" + index + ".tiff" ) e...

4 years ago | 0

| accepted

Answered
Area of contor from Matrix
Use scatteredInterpolant to resample the data on a grid, S=scatteredInterpolant(x,y,F); xg=linspace(min(x),max(x),500); yg=...

4 years ago | 0

| accepted

Answered
lsqnonlin: CheckGradients fails after multilying Jacobian with diagonal scaling matrix
%J=d(D*r)/darams = D*dr/dparams = D*J, right? No, it doesn't work because D=1/max(f) is not a constant. It depends on the un...

4 years ago | 0

| accepted

Answered
Create a function handle that is a sum of function handles
error=@(R) abs( vecnorm(POINTS-R) - R );

4 years ago | 1

Answered
Disable the gpu.
Matlab will use the CPU by default unless you have in some way told it to use the GPU for a specific computation. An exception...

4 years ago | 0

Answered
Constructor doesn`t work at all (Error using implicit default value of property in class)
Your posted code produces an error, but not the one you claim. You've misspelled the "Access" attribute, but once that is fixed ...

4 years ago | 0

| accepted

Answered
Multiplication of matrix and first dimension of a 3-D array without for loops
C=reshape( A*B(:,:) , size(B));

4 years ago | 1

Answered
Determine which string in an array matched using contains()
Easiest thing would be to just loop over the shorter of the two arrays, probably the pattern array: stringArray=stringArray(:);...

4 years ago | 1

| accepted

Load more