Community Profile

Bruno Luong

Last seen: Today
1,357 total contributions since 2009

View details...

Contributions in
View by

How to efficiently match the zeros of 1 matrix with another
The 3 for-loops can be shrink down to S(D==0) = 0;

1 day ago | 1

Why isn't eig returning all eigenvectors?
When you have multiple-order eigen value(s), the number of eigen vectors is not necessary equal to the order. Much simpler exam...

1 day ago | 0

mxn and nxn matrix element-wise multiplication without for loop
AA = permute(reshape(A,[n,k,n]),[2 1 3]); results = AA(:,:)*B(:)

2 days ago | 0

| accepted

Generate some points on the plane restricted by 3 points (triangle)
Another method: n = 1000; % number of random points p1 = [1 1 2]; p2 = [5 7 3]; p3 = [8 2 1]; w = -log(rand(3,n)); xyz =...

2 days ago | 1

MEX api and interleaved complex arrays
Where have you been Jan? In a cave? ;-) Sorry it couldn't resist. As I understand, when you call mxGetPr and mxGetPi, the data...

4 days ago | 1

| accepted

solve linear equation system with partially unknown coefficient matrix
Just using linear algebra, no extra tollbox is needed, of course n==1 is underdetermined problem % Generate random matrix n =...

5 days ago | 1

| accepted

MATLAB CODING - SIGNAL CONVOLUTION
x=[ 1 2 -2 4 6]; h=[ -1 2 3]; c=conv(x,h) M=convmtx(h,length(x)) x*M % return c

6 days ago | 0

| accepted

When the algorithm of Levenberg-Marquardt is preferred when doing curve fitting?
Trust region is more robust if you have strong non-linearity. This effect is "amplified" depends also how far the starting point...

6 days ago | 1

| accepted

Matlab Memory Consumption: moving surfaces?
I can copy/past my "answered" in this question: yes I have the same issue.

7 days ago | 0

How to plot sphere in sphere coordinates?
function sphere(r) phi = linspace(0,2*pi); theta = linspace(0,pi).'; % first change x = r*cos(phi).*sin(theta); y = r*sin(ph...

7 days ago | 1

Comparing all the elements of an array with all the elements of another array
This returns the elements in order as in B, from left to right A = 100:10:600 B = [100 103 105 120 123 128 130 200 205 207 300...

8 days ago | 1

| accepted

How to solve explicit equation of ellipse
There is a function EllAlg2Geo ready to use in this FEX % Random coefficients for test: A = 0.5+rand; D = 0.5+rand; B = rand...

8 days ago | 0

Combine griddedInterpolants on the same grid
If you know in advande the reference gridded points and the query points, (but the z data change), you migh build one ce interpo...

8 days ago | 0

Is anyone else having problems with MatLab 2020b freezing when saving/viewing figures? If so do you know any solutions?
I don't know if you have the same problem, in my case I found a large memory leak of TMW graphic system when using opengl hardwa...

8 days ago | 0

How t generate cone using scattered random point cloud?
This code provides the uniform distribution on the surface of the cone h = 3; % height r = 1; % base radius n = 1e4; % numbe...

8 days ago | 1

| accepted

Question

Why stock DOT function is suboptimally implemented
Followup the discussion in https://www.mathworks.com/matlabcentral/answers/612051-calculation-precision-changed-in-2020b and ...

9 days ago | 1 answer | 1

1

Question

column operator erases complex property
Why column (:) changes my data? (R2020b) >> z=complex(3,0) z = 3.000000000000000 + 0.000000000000000i >> isreal(z) ...

10 days ago | 1 answer | 3

1

Efficient number occurence count
ac = accumarray(num(:),1);

10 days ago | 1

How can i extract the value of an element of a sparse double?
full(M(3,3))

10 days ago | 0

| accepted

NaN from str2double('1 2 3') on Matlab 2020a
"works fine on Matlab 2018b" Are you sure? >> version ans = '9.5.0.1298439 (R2018b) Update 7' >> str2double('1 2 ...

12 days ago | 0

| accepted

How to multiply 3D matrices without using for loop
If you have R2020b C = pagemtimes(A,'ctranspose',B,'none'); Or using MTIMESX on File-Exchange I just make a quick comparison ...

12 days ago | 0

| accepted

What frustrates you about MATLAB? #2
MATLAB startup accelerator. I just don't like my computer being polluted by some services installed in the task scheduler. I pr...

12 days ago | 0

What frustrates you about MATLAB? #2
The camorbit/camlight (camera toolbar) that makes the 3D graphic rotation turns forever when I swing with the mouse. It's fun t...

12 days ago | 0

How to apply function "strrep" to more than 32 substrings?
newIDFFile = readIDFFile; for k=1:length(x) newIDFFile = strrep(newIDFFile, sprintf('@@P%d@@',k), x(k)); end

13 days ago | 1

Calculation precision changed in 2020b?
This is a robust code. theta = acos(max(min(dot(x,y)/sqrt(sum(x.^2)*sum(y.^2)),1),-1)) Note it returns 0 for x or y is 0. One...

13 days ago | 1

| accepted

How to enter variable names into plot title (R2019a)
title("2D Gaussian when mean is " + m(i) + " and standard deviation is " + s(i))

16 days ago | 0

I want to make a recursive formula and execute two statements with the same variables at the same time
I'm surpised nobody proposes yet a very MATLABish solution [a,b] = deal([a b],a]

16 days ago | 0