Community Profile

# Bruno Luong

Last seen: Today Active since 2009

All

#### Content Feed

View by

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

8 hours ago | 0

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

2 days ago | 0

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

2 days ago | 0

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

4 days ago | 0

| accepted

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

4 days ago | 0

| accepted

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

4 days ago | 1

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

5 days ago | 0

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

5 days ago | 0

| accepted

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

5 days ago | 2

| accepted

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

7 days ago | 0

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

8 days ago | 1

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

9 days ago | 0

| accepted

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

9 days ago | 0

| accepted

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

9 days ago | 1

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)]; %...

9 days ago | 0

| accepted

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

10 days ago | 0

| accepted

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

11 days ago | 0

| accepted

Fmincon failure in optimizing an objective function which includes determinant of a matrix.
Make sure your objective function returns real numerical output Nr=4;No=1; N = 4; h = sqrt(0.5)*(randn(N,N)+1i*randn(N,N)); ...

11 days ago | 0

| accepted

EASY QUESTION ABOUT THE lsqlin COMMAND: Is it possible to use the lsqlin algorithm for MIMO systems (always with linear constraints)?
As long as you have a linear least-squares model, linear equality and inequality constraints then yes you can use lsqlin, as cl...

17 days ago | 0

A very fast way to find elements and their indices? (Is ismember fast?)
You overly complicate your code for nothing, and yes ismember if fast. Not sure if your a is always single element or just in t...

17 days ago | 1

| accepted

A very fast way to sort datetime (in "ascend" mode)?
The first peak is due to JIT that is not kicks in. Here is the result on my PC (code attached) I have to chase what create t...

17 days ago | 0

How can I derive inverse of the matrix with infinite determinant?
"Is there way to compute the inverse of the matrix A?" No. The sum of all columns of your matrix A is numerically 0, therefore...

18 days ago | 2

How can I derive inverse of the matrix with infinite determinant?
Welcome to the world of numerical calculation. Every conclusion you made is wrong. "det(A) = Inf Therefore, it cannot compute t...

18 days ago | 3

How to fill a vector and change its elements when reaching a specific element?
x = zeros(1, 3600); x(1) = 0; dx = 20; for k=2:length(x) xk = x(k-1) + dx; if xk > 1000 dx = -20; ...

18 days ago | 0

| accepted

Elimination of for loops
L=2; T=1; w0=2*pi; N=3; % Any t as you like without restriction t = linspace(0,L*T,500); l = floor(t / T); dt = mod(t...

18 days ago | 0

Does the base Matlab have something similar to Java's command 'setDefaultCloseOperation'?
https://fr.mathworks.com/help/matlab/creating_plots/define-an-object-deletion-callback.html

18 days ago | 0

19 days ago | 1

| accepted

"uigetfile" only opens the matlab drive, not local file explorer
uigetfile open a file browser controller by the operating system. Usually user can navigate whereever he is allowed and in the ...

19 days ago | 0