Answered
To find exponent in power law equation of the form y = ax^m + b
If you have the Curve Fitting Toolbox, a = 0.55; m = 1.3; b = -0.78; % dummy data x = (1:25)'; y = a*x.^m + b + randn(si...

3 years ago | 0

Answered
Check Gradient (Jacobian) of objective function -- what is the meaning of absolute difference (1e-6) if component of gradient is less than 1 ?
If I know my values are so small (around 1e-7) per nature, a difference between 1e-7 and 2e-7 is significant. Not necessarily. ...

3 years ago | 0

| accepted

Answered
Removing semicolons from data
str = fileread('12h.json'); % dedicated for reading files as text  data = jsondecode(str); % Using the jsondecode function to...

3 years ago | 0

| accepted

Answered
Find distance from centroids to a specific point and remove objects that are having greater distance than the threshold
stat = regionprops(BW,'centroid','PixelIdxList'); ... CentroidDistances=pdist2(centroids,ECR); stat=stat(CentroidDistan...

3 years ago | 0

Answered
Draw circle in a rectangular
N=500; [x,y]=ndgrid(linspace(-10,10,N)); cmsk=x.^2+y.^2>=1; emsk=padarray(zeros(N-6),[3,3],1); [R,G,B]=deal(~cmsk&~em...

3 years ago | 0

Answered
Draw circle in a rectangular
s=([0 0 ; 0 1; 1 1; 1 0]-1/2)*20; t=linspace(0,360,1000)'; c=[cosd(t), sind(t)]; patch('XData',s(:,1),'YData',s(:,2),...

3 years ago | 0

| accepted

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

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

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

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

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

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

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

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

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

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

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

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

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

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

3 years ago | 0

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

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

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

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

3 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,:);

3 years ago | 1

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

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

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

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

3 years ago | 0

| accepted

Load more