Answered
Fast Euclidean Distance Calculation
vecnorm(X-Y,2,2);

4 years ago | 1

Answered
How to address error message "Matrix is close to a singular or badly scaled" when lsqnonlin was already able to run a few times?
Try scaling your residuals so that they all have approximately the same sensitivity to changes in the parameters.

4 years ago | 0

| accepted

Answered
Chessboard illumination - Problems using imrotate
f1=255*ones(64); f2=zeros(64); R1=[f1 f2 f1 f2 f1 f2 f1 f2]; R2=[f2 f1 f2 f1 f2 f1 f2 f1]; chess=[R1;R2;R1;R2;R1;R2;R1;R2]; ...

4 years ago | 1

| accepted

Answered
Using fit function ignoring NaN
include=~isnan(y); fobj = fit(x(include),y(include),fitType)

4 years ago | 3

| accepted

Answered
Find consecutive ones and save the contents
Download this, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vecto...

4 years ago | 1

Answered
How do I load .mat file and take certain columns and make them an array?
You could do it with matfile(), as in this example: https://www.mathworks.com/help/matlab/ref/matlab.io.matfile.html#mw_630b601...

4 years ago | 0

Answered
how to count array of 1 and 0 repeated times
Using, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vectors [~,~...

4 years ago | 0

Answered
Speeding up to find minimum value using min() function
c=c(:)'; b=interp1(c,1:numel(c),s,'nearest'); a=abs(c(b)-s)

4 years ago | 3

Answered
fmincon - penalty function
Problems (1) The objective function code you've shown appears to depend on everything except the unknown variables x (2) Assum...

4 years ago | 1

Answered
inputParser does not throw error
The validation function should be the 4th argument, addParameter(p, 'property_name','', isString) ;

4 years ago | 1

| accepted

Answered
Perform angle recognition on the objects in the following images
Perhaps as follows, load Image BW = edge(im2gray(A)); for i=1:5 E=bwmorph(BW,'endpoints'); BW=BW&~E; end BW=b...

4 years ago | 1

Answered
segment the vessels in the attached image
load Images B=bwareaopen(A>170,100); montage({A,B})

4 years ago | 0

Answered
calculate distance matrix for 3D points
Assuming xA, yA, zA, xB, yB, zB are column vectors, D=pdist2([ xA, yA, zA],[xB, yB, zB])

4 years ago | 0

Answered
How can you remove all sub-graphs that are not part of the largest component of connected sub-graphs?
Given a agraph, G, bins=biconncomp(G); [~,cmaj]=max(histcounts(bins,1:max(bins)+1)); ekeep=find(bins==cmaj)...

4 years ago | 0

| accepted

Answered
How to smooth a curve with movmean with consideration of the start and end of an array?
k=ones(1,301); k(8192)=0; for i = 1:1:8 tmp=fwd.Offset_itpl_mean{i}(:).'; tmp=ifft(fft(tmp).*fft(k),'sy...

4 years ago | 0

Answered
How Can I remove lines from the below images?
For the first image, I recommend bwlalphaclose() from, https://www.mathworks.com/matlabcentral/fileexchange/90762-further-tools...

4 years ago | 0

Answered
Building a graph from a matrix
Given an upper triangular matrix B Isn't B your adjacency matrix? If so, then why not just, G=graph(B);

4 years ago | 0

| accepted

Answered
Calculate adjusted R2 for constant model
R2=1-mean((y-constant).^2)/var(y);

4 years ago | 0

| accepted

Answered
Is there any way to get the uigetfile panel to be centered in the monitor when it first comes up????
If you drag the uigetfile window to the location where you want it then, the next time you call uigetfile, it will open in that ...

4 years ago | 0

Answered
Deriving rotation angle from the eigenvectors
If you download ellipsoidalFit() to do the fitting, the yaw-pitch-roll angles are avaialble directly from the object, https://w...

4 years ago | 0

Answered
Solving matrix equations?
You can try fsolve, but you will need a good initial guess, X0. X=fsolve(@(X) A1-A2*X+X*A3-X*A4*X, X0)

4 years ago | 1

| accepted

Answered
Conversion of a binary matrix to decimal matrix
A = [1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0;0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0]; e=kron(speye(2),2.^(7:-1:0)'); B = A*e

4 years ago | 1

Answered
Speedup of mldivide by parallelisation
mldivide is already highly well-optimized internally, without the need for an explicit parpool. It is not clear how distributing...

4 years ago | 0

| accepted

Answered
Optimization problem not finding the actual optimal value
Making sure you don't have any round(), ceil(), floor() or other discretization operations in your simulation code. Also, make s...

4 years ago | 0

| accepted

Answered
Mathworks: it's time for a dark theme.
Is a dark theme different from just setting the color preferences to black background and white text?

4 years ago | 1

Answered
How can I find the number of specific submatrices inside a matrix?
Sa=conv2(A.^2,ones(2),'valid'); Sb=sum(B(:).^2); n= nnz( conv2(A, rot90(B,2),'valid').^2==Sa.*Sb );

4 years ago | 1

| accepted

Answered
how to covert an irregular shape into an equivalent filled square?
Like in this example, perhaps. load Image imshow(Image) reg=regionprops(Image>0,'PixelIdxList','BoundingBox'); I=ceil(...

4 years ago | 0

Answered
how to get convolution for two signals without using conv command
You're probably meant to use the convolution property of FFTs.

4 years ago | 0

Answered
Converting parallel CPU processing into GPU processing
I would like to process matrices in a cell array on the GPU in parallel for how many cores are present on the gpu. No, GPU core...

4 years ago | 0

Load more