Question


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

plus de 3 ans il y a | 2 réponses | 0

2

réponses

Réponse apportée
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...

plus de 3 ans il y a | 2

| A accepté

Question


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

plus de 3 ans il y a | 2 réponses | 1

2

réponses

Réponse apportée
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...

plus de 3 ans il y a | 0

Réponse apportée
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...

plus de 3 ans il y a | 1

Réponse apportée
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 ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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)...

plus de 3 ans il y a | 1

Question


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

plus de 3 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
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...

plus de 3 ans il y a | 1

Réponse apportée
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(...

plus de 3 ans il y a | 0

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
optimization problem with arrays
Could you try this equivalent expression A=sum(array1.*(array1>0));

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 1

Réponse apportée
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...

plus de 3 ans il y a | 2

| A accepté

Réponse apportée
ICP (Iterative Closest Point) code
There are several codes in File exchange

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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))...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 1

Réponse apportée
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; ...

plus de 3 ans il y a | 0

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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'...

plus de 3 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 0

Réponse apportée
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)...

plus de 3 ans il y a | 1

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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(...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 1

Réponse apportée
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)]; %...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 3 ans il y a | 0

| A accepté

Charger plus