Answered

Efficient computation of the sum of pairwise absolute differences

The question: is there any way to make this work efficiently, ideally with conv2 or xcorr2? If you were taking the sum of squa...

Efficient computation of the sum of pairwise absolute differences

The question: is there any way to make this work efficiently, ideally with conv2 or xcorr2? If you were taking the sum of squa...

10 días ago | 0

Answered

Matrix-vector operations without loops

A=2*(HessW(:,:)*GradW(:));

Matrix-vector operations without loops

A=2*(HessW(:,:)*GradW(:));

10 días ago | 0

| accepted

Answered

Linear fitting with 2 variables

Assuming f is 3x1, x=rand(1,15); %Example data f=rand(3,1); y=3*x+2+7*f; [F,X]=ndgrid(f,x); p=num2cell( [X(:), X(:).^0...

Linear fitting with 2 variables

Assuming f is 3x1, x=rand(1,15); %Example data f=rand(3,1); y=3*x+2+7*f; [F,X]=ndgrid(f,x); p=num2cell( [X(:), X(:).^0...

10 días ago | 1

| accepted

Answered

I want to implement these equations in MATLAB but how?

fn=@(theta,k) exp((0:k-1).' * (2i*pi*d/lambda*sin(theta))); A=fn(theta,M); B=fn(theta,N); y=reshape( A*B.', [],1);

I want to implement these equations in MATLAB but how?

fn=@(theta,k) exp((0:k-1).' * (2i*pi*d/lambda*sin(theta))); A=fn(theta,M); B=fn(theta,N); y=reshape( A*B.', [],1);

10 días ago | 0

| accepted

Answered

How to get the camera scale factor

To get that, you need to image an object of known length at some known reference depth from the camera. You would also need to k...

How to get the camera scale factor

To get that, you need to image an object of known length at some known reference depth from the camera. You would also need to k...

10 días ago | 0

| accepted

Answered

solution of transcedental equation

eps1 = 1.5471; eps2 = 1.5431; eps1m = -9.894 ; eps2m = 1.0458; epsm = eps1m + i*eps2m; lambda = 633; k0 = (2*pi)/lambda;...

solution of transcedental equation

eps1 = 1.5471; eps2 = 1.5431; eps1m = -9.894 ; eps2m = 1.0458; epsm = eps1m + i*eps2m; lambda = 633; k0 = (2*pi)/lambda;...

10 días ago | 0

Answered

Calculate the Median of the results from 100 Simulations

impOOB=rand(100,5) median(impOOB,1)

Calculate the Median of the results from 100 Simulations

impOOB=rand(100,5) median(impOOB,1)

11 días ago | 0

| accepted

Answered

how to plot inequality and their intersection ?

The region prescribed by your inequalities is unbounded, so it is not clear what it means to "plot" it. If you really meant x<=2...

how to plot inequality and their intersection ?

The region prescribed by your inequalities is unbounded, so it is not clear what it means to "plot" it. If you really meant x<=2...

11 días ago | 0

Answered

How to rotate a 2d plot about the z axis to create a 3d object

See the cylinder command. https://www.mathworks.com/help/matlab/ref/cylinder.html t = 0:pi/10:2*pi; r = 2 + cos(t); [X,Y,Z]...

How to rotate a 2d plot about the z axis to create a 3d object

See the cylinder command. https://www.mathworks.com/help/matlab/ref/cylinder.html t = 0:pi/10:2*pi; r = 2 + cos(t); [X,Y,Z]...

11 días ago | 0

| accepted

Answered

Randomly selecting a number from different arrays

A = [11 11 11 12 12 12 13 13]; B = [21 21 21 22 22 22 23 23]; C = [31 31 31 32 32 32 33 33]; M=[A;B;C]; I=mod(cumsum(ran...

Randomly selecting a number from different arrays

A = [11 11 11 12 12 12 13 13]; B = [21 21 21 22 22 22 23 23]; C = [31 31 31 32 32 32 33 33]; M=[A;B;C]; I=mod(cumsum(ran...

11 días ago | 0

Answered

fmincon and the Objective function returned NaN warning

The sqp algorithm can recover from NaNs and Infs if your objective and constraint functions are finite on an open domain of x (I...

fmincon and the Objective function returned NaN warning

The sqp algorithm can recover from NaNs and Infs if your objective and constraint functions are finite on an open domain of x (I...

11 días ago | 0

Answered

Could you please help me to fit 2 circles so as to detect left and right half of breast?

Seems to me that you don't need to fit a circle, but rather to find the minimum bounding circle. For that, you could try minboun...

Could you please help me to fit 2 circles so as to detect left and right half of breast?

Seems to me that you don't need to fit a circle, but rather to find the minimum bounding circle. For that, you could try minboun...

11 días ago | 1

| accepted

Answered

The longest consecutive values in a vector and the position at which it starts and ends

Using "Tools for Processing Consecutive Repetitions in Vectors", https://www.mathworks.com/matlabcentral/fileexchange/78008-too...

The longest consecutive values in a vector and the position at which it starts and ends

Using "Tools for Processing Consecutive Repetitions in Vectors", https://www.mathworks.com/matlabcentral/fileexchange/78008-too...

11 días ago | 0

Answered

Randomising a vector with respect to the probability of the outcome

I=randi(5,1,12); J=1:12; result=reshape( sparse(I,J,1,5,12) ,[],1); full(result(:))

Randomising a vector with respect to the probability of the outcome

I=randi(5,1,12); J=1:12; result=reshape( sparse(I,J,1,5,12) ,[],1); full(result(:))

11 días ago | 0

Answered

Creating artificial pictures based on an original picture

Sounds like a job for a GAN, https://www.mathworks.com/help/deeplearning/ug/train-generative-adversarial-network.html

Creating artificial pictures based on an original picture

Sounds like a job for a GAN, https://www.mathworks.com/help/deeplearning/ug/train-generative-adversarial-network.html

11 días ago | 0

Answered

Plot for the following program is not showing up, i am trying to plot value of M1 for given L

M1 needs to be a vector: for L=1:799 if ____ M1(L)=____ elseif ___ M1(L)=____ else M1(L)...

Plot for the following program is not showing up, i am trying to plot value of M1 for given L

M1 needs to be a vector: for L=1:799 if ____ M1(L)=____ elseif ___ M1(L)=____ else M1(L)...

12 días ago | 0

Answered

Matlab fitting an anonymous function

The difference is that, with an anonymous function, you now have the responsibility of providing the StartPoint for the iterativ...

Matlab fitting an anonymous function

The difference is that, with an anonymous function, you now have the responsibility of providing the StartPoint for the iterativ...

12 días ago | 0

| accepted

Answered

How to solve 4 non linear equations with 5 unknowns using least square method

There are probably going to be infinite solutions, but you can use fsolve() to find one of them.

How to solve 4 non linear equations with 5 unknowns using least square method

There are probably going to be infinite solutions, but you can use fsolve() to find one of them.

12 días ago | 0

Answered

Matlab static variable that can be modified by super class and sub class?

You mean you want all instances of the class and its subclasses to share the same copy of staticvar? If so, you can write the s...

Matlab static variable that can be modified by super class and sub class?

You mean you want all instances of the class and its subclasses to share the same copy of staticvar? If so, you can write the s...

12 días ago | 0

| accepted

Answered

Nested for loop performance speed up

With the data sizes you've shown, the final result D will be a 7GB logical matrix. That seems like a non-starter. If you can red...

Nested for loop performance speed up

With the data sizes you've shown, the final result D will be a 7GB logical matrix. That seems like a non-starter. If you can red...

12 días ago | 1

Answered

Polyshape rotation without distort

Probably because the data aspect ratio of your plot is not 1. I.e., the scales of your x and y axes are different.

Polyshape rotation without distort

Probably because the data aspect ratio of your plot is not 1. I.e., the scales of your x and y axes are different.

12 días ago | 0

| accepted

Answered

How to split array into sub arrays?

The way you would do this is to convert the vector to a cell array. There is no way to do it without a loop. You can use mat2til...

How to split array into sub arrays?

The way you would do this is to convert the vector to a cell array. There is no way to do it without a loop. You can use mat2til...

12 días ago | 0

Answered

Split large vector into smaller vectors based on upper and lower limits

Using this File Exchange submission, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutiv...

Split large vector into smaller vectors based on upper and lower limits

Using this File Exchange submission, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutiv...

12 días ago | 0

Answered

Using parfor eliminates use of multithreading

If you are getting the best performance from the Linux command line, perhaps a solution would be to invoke the Linux command li...

Using parfor eliminates use of multithreading

If you are getting the best performance from the Linux command line, perhaps a solution would be to invoke the Linux command li...

13 días ago | 0

Answered

How do I find the instersection on my plot?

You can use fzero, e.g., fun=@(x)x^2; y=4; x_intersect=fzero(@(x) fun(x)-y,[0,1e6])

How do I find the instersection on my plot?

You can use fzero, e.g., fun=@(x)x^2; y=4; x_intersect=fzero(@(x) fun(x)-y,[0,1e6])

13 días ago | 0

| accepted

Answered

running a consensus protocol on a directed graph created my an Adj-matrix

Did you mean to have this? ux(i,1) = ux(i,1) + (x(i,j)- x(i,i)) It's not clear from your original code how you expected to get...

running a consensus protocol on a directed graph created my an Adj-matrix

Did you mean to have this? ux(i,1) = ux(i,1) + (x(i,j)- x(i,i)) It's not clear from your original code how you expected to get...

13 días ago | 0

Answered

splitapply doesn't split well into bins

You can use accumarray instead. spltsum=accumarray(dis(valid), cell1areas(valid) , [90,1]);

splitapply doesn't split well into bins

You can use accumarray instead. spltsum=accumarray(dis(valid), cell1areas(valid) , [90,1]);

13 días ago | 0

| accepted

Answered

why my integral is not a numerical value?

f=matlabFunction( bras*ket); phase=1i*integral(f,-2*pi,2*pi)

why my integral is not a numerical value?

f=matlabFunction( bras*ket); phase=1i*integral(f,-2*pi,2*pi)

13 días ago | 0

| accepted

Answered

Creat a loop for Image processing

It is possible: for i=1:69; pic=im2gray( imread(i+".tiff") ); ... end

Creat a loop for Image processing

It is possible: for i=1:69; pic=im2gray( imread(i+".tiff") ); ... end

13 días ago | 0