Answered

How to find b spline values?

After computing the derivative spline_position = spaps(time ,x,0,3); % x is a 101 element vector representing postion, I'm...

How to find b spline values?

After computing the derivative spline_position = spaps(time ,x,0,3); % x is a 101 element vector representing postion, I'm...

18 hours ago | 0

| accepted

Answered

How to efficiently match the zeros of 1 matrix with another

The 3 for-loops can be shrink down to S(D==0) = 0;

How to efficiently match the zeros of 1 matrix with another

The 3 for-loops can be shrink down to S(D==0) = 0;

3 days ago | 1

Answered

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

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

3 days ago | 0

Answered

mxn and nxn matrix element-wise multiplication without for loop

AA = permute(reshape(A,[n,k,n]),[2 1 3]); results = AA(:,:)*B(:)

mxn and nxn matrix element-wise multiplication without for loop

AA = permute(reshape(A,[n,k,n]),[2 1 3]); results = AA(:,:)*B(:)

4 days ago | 0

| accepted

Answered

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

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

4 days ago | 1

Answered

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

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

6 days ago | 1

| accepted

Answered

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

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

7 days ago | 1

| accepted

Answered

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

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

8 days ago | 0

| accepted

Answered

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

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

8 days ago | 1

| accepted

Answered

Matlab Memory Consumption: moving surfaces?

I can copy/past my "answered" in this question: yes I have the same issue.

Matlab Memory Consumption: moving surfaces?

I can copy/past my "answered" in this question: yes I have the same issue.

9 days ago | 0

Answered

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

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

9 days ago | 1

Answered

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

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

10 days ago | 1

| accepted

Answered

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

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

10 days ago | 0

Answered

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

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

10 days ago | 0

Answered

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

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

10 days ago | 0

Answered

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

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

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

10 days ago | 1 answer | 1

Question

column operator erases complex property

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

12 days ago | 1 answer | 3

Answered

How can i extract the value of an element of a sparse double?

full(M(3,3))

How can i extract the value of an element of a sparse double?

full(M(3,3))

12 days ago | 0

| accepted

Answered

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

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

14 days ago | 0

| accepted

Answered

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

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

14 days ago | 0

| accepted

Answered

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

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

14 days ago | 0

Answered

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

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

14 days ago | 0

Answered

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

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

15 days ago | 1

Answered

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

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

15 days ago | 1

| accepted

Answered

How to enter variable names into plot title (R2019a)

title("2D Gaussian when mean is " + m(i) + " and standard deviation is " + s(i))

How to enter variable names into plot title (R2019a)

title("2D Gaussian when mean is " + m(i) + " and standard deviation is " + s(i))

18 days ago | 0

Answered

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]

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]

18 days ago | 0

Answered

Randomly chooses points from a triangular region and stores the x and y coordinates

This is a direct method, no loop, no discard, etc... n = 1e4; b = 1; h = 2; w1=1-sqrt(rand(1,n)); w2=(1-w1).*rand(1,n); ...

Randomly chooses points from a triangular region and stores the x and y coordinates

This is a direct method, no loop, no discard, etc... n = 1e4; b = 1; h = 2; w1=1-sqrt(rand(1,n)); w2=(1-w1).*rand(1,n); ...

18 days ago | 0