Pregunta


parpool sorting out the default number of workers
I'm a little bit lost in the default number of workers when parpool() is invoked. My PC is standalone with Intel Processor and W...

más de 3 años hace | 2 respuestas | 0

2

respuestas

Respondida
What is the efficient way to loop though a multidimensional array in matlab?
The inner most loop should be the fist index, the outer most loop last index. Since MATLAB arranges data with first-dimension v...

más de 3 años hace | 2

| aceptada

Pregunta


parfor unable to classify, why?
Can someone explain why the ind2sub first statement triggers the error, but the second works fine? m = 2; n = 3; mycell = cel...

más de 3 años hace | 2 respuestas | 1

2

respuestas

Respondida
The proper way to sample 3 normally or lognormal distributed variables added up to 1
This will generate 3 random variables positives and sum to 1, with mean 8/10, 1/10, 1/10: nu=[8 1 1]; B=arrayfun(@(n) ones(1,n...

más de 3 años hace | 0

Respondida
How does matlab get the combinations that meet certain conditions in the matrix
You don't need MATLAB at all. From 2A1 = A2 A1 + A2, We divide by A1, and factor A2 on rhs to get 2 = A2*(1+1/A1) Meaning 2...

más de 3 años hace | 1

Respondida
How to vectorize this piece of code and why doesn't e come out to be zero though it must come out to be zero because u and b are equal?
Not tested but this for i=1:K for h=1:M ae(h,i)=exp(j*2*pi*(h-1)*d*sind(b(i))); %%%%% ae end for p=1:N ...

más de 3 años hace | 0

| aceptada

Respondida
How to standardize an array so that the maximum value is 1 and minimum is -1 keeping the zero value as zero?
A "smooth" mapping % Data a=randi([-10,10],1,5) pp=pchip([min(a) 0 max(a)], -1:1); normfun=@(a) ppval(pp,a) an=normfun(a)...

más de 3 años hace | 1

Pregunta


Largest lindexing supported by MATLAB?
What is the largest (linear) indexing supported by MATLAB? I would be good to know if there is an official specification for suc...

más de 3 años hace | 1 respuesta | 0

1

respuesta

Respondida
chol() returns error even the matrix is positive definite.
This statement B1 = d.\B; looks very suspecious to me (the .\ operator), if you remove the dot it will work. Here you do el...

más de 3 años hace | 1

Respondida
Implement an arbitrary number N nested for loop
Assuming a not so bug N of 100, and each of your list_to_loop has 2 elements, and you can compute 1000000000 (1e9) Dosomething(...

más de 3 años hace | 0

Respondida
Rename variable throughout project/directory
Use grep sed command of linux system. There light be some linux shell (cygwin?) on windows that you can install if you are under...

más de 3 años hace | 0

| aceptada

Respondida
optimization problem with arrays
Could you try this equivalent expression A=sum(array1.*(array1>0));

más de 3 años hace | 1

| aceptada

Respondida
Two functions having the same name but one being capital?
"Well, it would appear from the evidence that Matlab is not case sensitive... " No MATLAB is case sensitive "I can't save dupl...

más de 3 años hace | 1

Respondida
MatLab parfor slows down when I minimize the MatLab window and start using another program in win10, why?
May be this windows setup has something to do with it https://www.tenforums.com/tutorials/89429-adjust-processor-resources-best...

más de 3 años hace | 2

| aceptada

Respondida
ICP (Iterative Closest Point) code
There are several codes in File exchange

más de 3 años hace | 0

| aceptada

Respondida
Vectorize application of xcorr() function
Vectorized method but for-loop with preallocation is faster t = 0:1e-3:1-1e-3; Ts = 5e-2; fd_ = -8:0.1:8; s = rand(size(t))...

más de 3 años hace | 0

| aceptada

Respondida
Why doesn't evalin('caller','nargout') work?
Obviously it is NOT a normal "function", according to the doc of nargout "nargout returns the number of function output argumen...

más de 3 años hace | 0

| aceptada

Respondida
Numerical calculation of Hessian for a very complex problem
Never trust fmincon hessian. The hessian output is approximation for solely the goal of determine the descend direction internal...

más de 3 años hace | 0

| aceptada

Respondida
How do I connect two points from my Adjacency Matrix that are k distance away from each other and display it in my graph?
"You will quickly notice that there are a lot of nodes right next to each other but they do not have an edge connected to each o...

más de 3 años hace | 1

Respondida
Is there any matlab function to calculate moving mean square error?
Assuming you have 2 signals S1 and S2 in 1 x N arrays: N = 1000; S1 = randn(1,N); S2 = randn(1,N); n = 10; dS = S1 - S2; ...

más de 3 años hace | 0

Respondida
strange performance behavior - microbenchmark
My guess is in the first code, the intermediate result does have to be stored in memory. It can be in processor register or in t...

más de 3 años hace | 0

| aceptada

Respondida
Generating Exaustive Parameter Combinations
I start with a scalar structure s rather than the structure array, since paramereters might have different lengths s=struct('a'...

más de 3 años hace | 2

| aceptada

Respondida
Generate random numbers with conditions (min, max, mean, and specific values)
Use this fex https://fr.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum r = randperm([16+zeros(4,1...

más de 3 años hace | 0

Respondida
An issue with eigenvectors...
Remove the rational option "r" (not reliable) you'll be fine w = magic(3) disp(w) sz=size(w); tm=sz(1,1); p=round(poly(w)...

más de 3 años hace | 1

Respondida
Is it worth recoding simpler versions of built-in MATLAB functions to speed up performance?
You are free to strip down anything you want, just don't use the same name as the stock function. As soon as you change the spe...

más de 3 años hace | 0

| aceptada

Respondida
how to find average value up to current row in Matrix
A = [ 128 8.4 127 8.7 128 8.3 ] A1 = A(:,1); cs1 = cumsum(A1); B = [cs1, cumsum(...

más de 3 años hace | 0

| aceptada

Respondida
How to look up a smaller array in a larger array while preserving shape
Use convolution to detect matching % I modified it to make example more interesting LargeArray= [0,0,0,0;1,0,0,0;1,0,0,0;1,1,0...

más de 3 años hace | 1

Respondida
Array assembly by indexing in a loop
n = 4; x1 = linspace(0,2,n); y1_x1 = sqrt(1-( (x1.^2)/4 ) ); Y1_X1 = []; for i = 1:n Y1_X1 = [Y1_X1, y1_x1(i:end)]; %...

más de 3 años hace | 0

| aceptada

Respondida
Vectorization of a for loop to increase speed
This returns a matrix, whose elements which do not satisfy the condition and was not computed in your orginal code are marked by...

más de 3 años hace | 0

| aceptada

Respondida
an Alternative funtion which is faster than "ismember"
If XY is gridded coordinates, then you can use discretize or simple division if they are uniform to determine which grid the riv...

más de 3 años hace | 0

| aceptada

Cargar más