Answered

Please help me vectorize my loop to construct query vector from sample points

xs=cumsum(ceil(10*rand(1,10))) t=pi; p=cumsum([0 ceil(diff(xs)/t)]); xq=interp1(p,xs,0:p(end))

Please help me vectorize my loop to construct query vector from sample points

xs=cumsum(ceil(10*rand(1,10))) t=pi; p=cumsum([0 ceil(diff(xs)/t)]); xq=interp1(p,xs,0:p(end))

2 giorni ago | 0

| accepted

Answered

Non-convex shape as a collisionBox for robot path planning

The MATLAB probably use GJK algorithm that requires convex shape. You should split the object in sum of convex. I can recommend...

Non-convex shape as a collisionBox for robot path planning

The MATLAB probably use GJK algorithm that requires convex shape. You should split the object in sum of convex. I can recommend...

3 giorni ago | 0

Answered

Fast implementation of max-plus matrix multiplication

function C = mp_prod(A,B) m=size(A,1); n=size(B,2); AA=reshape(A,m,1,[]); BB=reshape(B.',1,n,[]); C=max(AA+BB,[],3); tic/t...

Fast implementation of max-plus matrix multiplication

function C = mp_prod(A,B) m=size(A,1); n=size(B,2); AA=reshape(A,m,1,[]); BB=reshape(B.',1,n,[]); C=max(AA+BB,[],3); tic/t...

3 giorni ago | 2

Answered

Preallocating cells with unknown output size

If the size is not known, a good way is the to grow the preallocation array exponentially. Rather than the assigment X{i,j} =...

Preallocating cells with unknown output size

If the size is not known, a good way is the to grow the preallocation array exponentially. Rather than the assigment X{i,j} =...

4 giorni ago | 0

| accepted

Answered

Size mismatch error on dimension 2: expected 1, but actual size is 3 (Matlab Coder)

Size of ones(SimCoreIn(k).Ns,SimCoreIn(k).Np) = 102 x 3 So (102 x 1).*(102 x 3) gives (102 x 3) right. Right but cod...

Size mismatch error on dimension 2: expected 1, but actual size is 3 (Matlab Coder)

Size of ones(SimCoreIn(k).Ns,SimCoreIn(k).Np) = 102 x 3 So (102 x 1).*(102 x 3) gives (102 x 3) right. Right but cod...

5 giorni ago | 0

| accepted

Answered

Why the sparse pattern of a sparse matrix changed

The mex probably creates a non-valid sparse matrix, use spok to check validity

Why the sparse pattern of a sparse matrix changed

The mex probably creates a non-valid sparse matrix, use spok to check validity

5 giorni ago | 1

| accepted

Answered

continuous piecewise linear approximation of data set

see if this can help you https://www.mathworks.com/matlabcentral/fileexchange/25872-free-knot-spline-approximation

continuous piecewise linear approximation of data set

see if this can help you https://www.mathworks.com/matlabcentral/fileexchange/25872-free-knot-spline-approximation

6 giorni ago | 0

Answered

App does not execute properly unless in debug mode [R2020b]

May be you should add drawnow so as things get refresed app.run.Enable='off' drawnow

App does not execute properly unless in debug mode [R2020b]

May be you should add drawnow so as things get refresed app.run.Enable='off' drawnow

6 giorni ago | 0

Answered

Calling script from a function is recommended?

Inconvenience: MATLAB coder cannot work on script inside function

Calling script from a function is recommended?

Inconvenience: MATLAB coder cannot work on script inside function

6 giorni ago | 0

Question

Calling script from a function is recommended?

Now and then I call script from a function, the purspose is often initialize some constant values that are shared by across the ...

6 giorni ago | 2 answers | 0

Answered

How to speed up this for loop containing kronecker product?

Yesterday I profile your code and the majority of time is eaten by H = K_D*K_D' - K_S*K_S'; not by Kronecker. The question is...

How to speed up this for loop containing kronecker product?

Yesterday I profile your code and the majority of time is eaten by H = K_D*K_D' - K_S*K_S'; not by Kronecker. The question is...

7 giorni ago | 0

Answered

svds(X,r) and svd(X,'econ') generating different singular vectors for large complex matrix X ??

The singular value (eigen) decomposition SVD/SVDS is not unique, vectors is up to scaling, (values is up to order for eigen valu...

svds(X,r) and svd(X,'econ') generating different singular vectors for large complex matrix X ??

The singular value (eigen) decomposition SVD/SVDS is not unique, vectors is up to scaling, (values is up to order for eigen valu...

7 giorni ago | 1

| accepted

Answered

How to find the first element in ascending numbers that repeat?

A = [1 2 3 4 0 1 0 1 0 1 0 1 2 3 4 0 1 0 1 0 1 1 2 3 4] b = find(A(1:end-1)==1 & diff(A)>0)

How to find the first element in ascending numbers that repeat?

A = [1 2 3 4 0 1 0 1 0 1 0 1 2 3 4 0 1 0 1 0 1 1 2 3 4] b = find(A(1:end-1)==1 & diff(A)>0)

8 giorni ago | 0

Answered

Calculating a matrix with a specific form

There might be a better mehod, at least more geometric, than linear system solving. I understand you want to find m (3 x 1) suc...

Calculating a matrix with a specific form

There might be a better mehod, at least more geometric, than linear system solving. I understand you want to find m (3 x 1) suc...

8 giorni ago | 2

Answered

How to select complementary elements from a vector?

>> d(~ismember(d,I)) ans = 2 5 6 8 9 0

How to select complementary elements from a vector?

>> d(~ismember(d,I)) ans = 2 5 6 8 9 0

8 giorni ago | 0

Answered

Vectorization of Weighted Minkowski Distance

[n,m] = size(X); % do not use length Xi = reshape(X,[n,1,m]); Xj = reshape(X,[1,n,m]); tt = reshape(theta,[1,1,m]); Mat2 = s...

Vectorization of Weighted Minkowski Distance

[n,m] = size(X); % do not use length Xi = reshape(X,[n,1,m]); Xj = reshape(X,[1,n,m]); tt = reshape(theta,[1,1,m]); Mat2 = s...

8 giorni ago | 0

| accepted

Answered

How to find the first number, ignore subsequent until a greater number repeats.

A = [ 0 3 0 3 0 3 0 3 0 4 0 4 0 4 0 4 0 5 0 5 0 5 0 5 0 5 0 3 0 3 0 3]: b = find(A==3); c = diff(b); b([1 find(c>c(1),1,'firs...

How to find the first number, ignore subsequent until a greater number repeats.

A = [ 0 3 0 3 0 3 0 3 0 4 0 4 0 4 0 4 0 5 0 5 0 5 0 5 0 5 0 3 0 3 0 3]: b = find(A==3); c = diff(b); b([1 find(c>c(1),1,'firs...

9 giorni ago | 1

| accepted

Answered

Assignment of variables by comma separated lists

Use deal >> A = struct('number', cell(1, 5)); >> A A = 1×5 struct array with fields: number >> n=1:5; >> c...

Assignment of variables by comma separated lists

Use deal >> A = struct('number', cell(1, 5)); >> A A = 1×5 struct array with fields: number >> n=1:5; >> c...

9 giorni ago | 0

Answered

High level question: use Matlab Compiler to integrate a function.m into C++ code

You need Compiler SDK to build shaed library Compiler alone can compile only to standalone app

High level question: use Matlab Compiler to integrate a function.m into C++ code

You need Compiler SDK to build shaed library Compiler alone can compile only to standalone app

9 giorni ago | 1

Answered

Mesh plot of the function sqrt(y-x^2)

Here is the surface in meshgrid form s = -1:0.01:1; y = 0:0.1:9; [S, Y] = meshgrid(s,y); X = S.*sqrt(Y); Z = sqrt(max(Y-X.^...

Mesh plot of the function sqrt(y-x^2)

Here is the surface in meshgrid form s = -1:0.01:1; y = 0:0.1:9; [S, Y] = meshgrid(s,y); X = S.*sqrt(Y); Z = sqrt(max(Y-X.^...

9 giorni ago | 0

Answered

Force constant slope in linear regression

% find intercept such that % y ~= givenslope*x + intercept % in the least squares sense intercept = mean(y - givenslope*x)

Force constant slope in linear regression

% find intercept such that % y ~= givenslope*x + intercept % in the least squares sense intercept = mean(y - givenslope*x)

10 giorni ago | 0

Answered

Find random solutions of a system of inequalities

For small dimensions, you might use existing tools in FEX to enumerate the vertexes of the polytopes. If the domain is non boun...

Find random solutions of a system of inequalities

For small dimensions, you might use existing tools in FEX to enumerate the vertexes of the polytopes. If the domain is non boun...

11 giorni ago | 1

Answered

How do we change the maximum number of parallel cores without a visual interface?

flow.com/questions/25563906/how-can-i-change-numworkers-in-parallel-cluster-profile-when-matlab-starts

How do we change the maximum number of parallel cores without a visual interface?

flow.com/questions/25563906/how-can-i-change-numworkers-in-parallel-cluster-profile-when-matlab-starts

11 giorni ago | 1

| accepted

Answered

ranking the data in matrix and arrange them as per rank.

>> D=[1 2 3; 7 8 9; 4 5 6; 3 0 5]; E=[D sum(D')' ranks(sum(D')')] Unrecognized function or variable 'ranks'. Did you mean:...

ranking the data in matrix and arrange them as per rank.

>> D=[1 2 3; 7 8 9; 4 5 6; 3 0 5]; E=[D sum(D')' ranks(sum(D')')] Unrecognized function or variable 'ranks'. Did you mean:...

12 giorni ago | 0

| accepted

Answered

How can I generate all possible combinations of a vector containing specific numbers in it?

J=nchoosek(1:8,3); [m,n]=size(J); I=repmat((1:m)',1,n); accumarray([I(:) J(:)],1)

How can I generate all possible combinations of a vector containing specific numbers in it?

J=nchoosek(1:8,3); [m,n]=size(J); I=repmat((1:m)',1,n); accumarray([I(:) J(:)],1)

13 giorni ago | 0

| accepted

Answered

This error was detected while a MEX-file was running.

It simply means the MEX file is buggy.

This error was detected while a MEX-file was running.

It simply means the MEX file is buggy.

13 giorni ago | 0

Answered

Why it is not possible to do array indexing directly after function that returns array?

There might be some syntax confusion that leads TMW not to do that. The issue is that the indexing and function argument both us...

Why it is not possible to do array indexing directly after function that returns array?

There might be some syntax confusion that leads TMW not to do that. The issue is that the indexing and function argument both us...

13 giorni ago | 1

Question

What is the advantage of Help with web connection

It seems MATLAB help switch recently by default on "Web documentation" It kind of anoying where the doc is available locally. W...

13 giorni ago | 1 answer | 1