Community Profile

# Bruno Luong

Last seen: Today Aktiv seit 2009

#### Statistics

All

Abzeichen anzeigen

#### Content Feed

Anzeigen nach

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

etwa 17 Stunden vor | 0

| akzeptiert

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

etwa 19 Stunden vor | 0

| akzeptiert

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

ein Tag vor | 1

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

2 Tage vor | 0

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

2 Tage vor | 0

| akzeptiert

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

2 Tage vor | 2

| akzeptiert

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

4 Tage vor | 0

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

5 Tage vor | 1

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

6 Tage vor | 0

| akzeptiert

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

6 Tage vor | 0

| akzeptiert

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

6 Tage vor | 1

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

6 Tage vor | 0

| akzeptiert

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

7 Tage vor | 0

| akzeptiert

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

8 Tage vor | 0

| akzeptiert

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

8 Tage vor | 0

| akzeptiert

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

14 Tage vor | 0

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

14 Tage vor | 1

| akzeptiert

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

14 Tage vor | 0

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

15 Tage vor | 2

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

15 Tage vor | 3

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

15 Tage vor | 0

| akzeptiert

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

15 Tage vor | 0

Beantwortet
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

15 Tage vor | 0

Beantwortet
Does the latest version of MATLAB support fmincon with gpuarray?
Discuss recently about this limitation of optimizer functions, no currently they won't support GPU array.

16 Tage vor | 1

| akzeptiert

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

16 Tage vor | 0

Beantwortet
Why is the derivative of a matrix not of the same order?
I guess you mistaken between numerical finite difference https://fr.mathworks.com/help/matlab/ref/diff.html and symbolic deriv...

17 Tage vor | 0

Beantwortet
In my code the parfor is slower than for loop when using backslah with matrices.
There is no problem. There might be no benefit to run parfor on function that is designed with multithread and already exploit...

17 Tage vor | 5

| akzeptiert

Beantwortet
Count the number of times a particular sequence occurs in the vector.
Not for-loop but it does the job A=randi(0:1,1,10) spattern = [0 1]; startidx = strfind(A,spattern)

17 Tage vor | 0

Beantwortet
Determine the number of elements in succession in a vector that are equal in a succinct way
You can use many runlength in filesubmission. I use here my own; x = [4 4 4 4 4 1 1 1 1 1 1 2 2 2 2 2 2 2 4 4 4 4 4 4 4] [le...

17 Tage vor | 0

| akzeptiert

Beantwortet
Vectorisation to replace for loop: Steganography text hiding
Second take: d = nan(numel(px),1); d(LSB===0) ) = 1; d(LSB===1) ) = -1; d(LSB==binaryTxt) = 0; b = isfinit(d); pxk = px(is...

17 Tage vor | 0