Question

Is it possible to perform multiplication and update 'val' inside accumarray?

An accumarray function is defined as A = accumarray(subs,val,sz) I am running accumarray function in a loop , Is it po...

3 months ago | 0 answers | 0

Question

Is there a function that performs element by element multiplication between two variables and stores in one of the variable by default?

I want to do this operation A = A.*B; Is there a function func(A, B) that multiplies A and B and saves the res...

3 months ago | 2 answers | 0

Question

Summing of non-zero elements of columns using indexing

I have idx, is there a way of using idx to make the sum(matrix,1) in the below code cheaper. In another words, is it possible to...

3 months ago | 2 answers | 0

Answered

HI friends, I need a matlab code of economic load dispatch with loss.

Here is one code which I found https://www.mathworks.com/matlabcentral/fileexchange/49456-economic-dispatch-including-losses He...

HI friends, I need a matlab code of economic load dispatch with loss.

Here is one code which I found https://www.mathworks.com/matlabcentral/fileexchange/49456-economic-dispatch-including-losses He...

3 months ago | 0

Question

is there any faster way to operate a group of statements in a loop only once, than applying if else

for ......... statemets 1; statements 2: if iteration == 0 [value1,value2] = function(args1,args2); %dependent on ...

3 months ago | 1 answer | 0

Answered

How can I make derivatives with several variables?

You can try this a = a1^2*a2^2; diff(a,a1) + diff(a,a2); ans = 2*a1^2*a2 + 2*a1*a2^2

How can I make derivatives with several variables?

You can try this a = a1^2*a2^2; diff(a,a1) + diff(a,a2); ans = 2*a1^2*a2 + 2*a1*a2^2

3 months ago | 1

Question

Sparse for element by element operation

If we want to perform the product of two sparse matrices or sparse and a full matrix , sparse function is very useful as it avoi...

3 months ago | 2 answers | 0

Question

Sparse and binary mask

I am working on saving computations and speeding up my Matlab code. Here's what I do Perform thresholding on an image and mak...

3 months ago | 3 answers | 0

Question

saving multiplications with zeros in a loop

%if true for i iterations Matrix = Matrix.*phase %Matrix has lot of zeros I want to skip multiplications with zero. Is it po...

3 months ago | 1 answer | 0

Question

convert whole code to double

is it possible by anyway to convert whole code to double in a single step? For operations such as sparse single format and integ...

3 months ago | 1 answer | 0

Question

Calculate values only once in the loop

Suppose I have a code running in a loop I have done some operations and I create a matrix in the loop, that matrix has the sam...

3 months ago | 2 answers | 0

Question

can anyone tell me an intuitive way of finding number of bins for histcounts function

The binning algorithm used by matlab is very expensive [N,edges] = histcounts(I) Instead I am looking for some different and co...

3 months ago | 1 answer | 0

Question

why does method 1 result not equal to method 2 result even if both perform the same thing ?

a = [2 5 2 9 ; 3 2 5 0; 4 5 9 2; 1 6 1 5] threshold = 3 %function 1 z = 0; for n = 1: size(a,1) for m = 1...

3 months ago | 1 answer | 0

Question

How do I threshold the image automatically based on its energy content?

Say my threshold is taking in those components that constitute about 75% of energy of image and making the remaining as zero.How...

3 months ago | 1 answer | 0

Question

Histogram based thresholding for reduction in computation

i am planning to use histcounts () function for histogram based threshold We know that histogram is a plot of pixel intensity v...

3 months ago | 2 answers | 0

Question

Getting values of the histogram without actually plotting it

<</matlabcentral/answers/uploaded_files/130633/Screenshot%20(259).png>> Hello, I am working on automatically adjusting the th...

4 months ago | 1 answer | 0

Question

Difference between graythresh and multithresh for one value of threshold.

graythresh(I) and multithresh(I,1) gives me different values even if both are based on otsu's method of thresholding Why?

4 months ago | 1 answer | 0

Question

For a loop , to carry out element by element multiplication is bsxfun better than conventional element by element.

for number of iterations A = A.*B; %A and B both are complex end Will the loop be faster if I replace A.*B wit...

4 months ago | 3 answers | 1

Question

Complex matrix , make certain elements of real and imaginary as zero in a single line without storage

Suppose I have the following complex matrix s = rng; A = complex(randn(5,5),randn(5,5)); T = 0.15 How do I make bo...

4 months ago | 1 answer | 0

Question

Given an image , how to efficiently (vectorization) make all the elements to zero except the one with information?

The image is scaled color version of absolute value of the matrix.

4 months ago | 2 answers | 0

Question

Multiplication of Sparse complex matrix and a full matrix

Let A be a sparse matrix and B be a full matrix . C = A.*B. Will multiplication of elements of B corresponding to the zero elem...

4 months ago | 1 answer | 0

Question

Sparse matrix and savings

I have a complex matrix which has non zero values only in specific region of the matrix. And most of the remaining part is equal...

4 months ago | 1 answer | 0

Question

How do I threshold only real part of a complex matrix?

For a complex matrix how do I threshold only the real part of its elements to zero if I have complex matrix A, |A(real(A)>0.5)=...

4 months ago | 1 answer | 0

Question

Query regarding a sparse complex matrix

I have a complex matrix, I have to create its sparse form using sparse function. How do I store it in lesser bytes than the orig...

4 months ago | 2 answers | 0