Question

Appdesigner cut/past bug?

When I open R2020b appdesigner of a mapp file created under R2020a, the cut and past menu is grayed out (and action using shortc...

20 jours ago | 0 answers | 0

Answered

How to compose a function n-times and want value for a particular value of n?

f = @(x) x.^2-x; n = 10; x = 1/pi; y = x; for k=1:n y = f(y) end % y is f^10(x)

How to compose a function n-times and want value for a particular value of n?

f = @(x) x.^2-x; n = 10; x = 1/pi; y = x; for k=1:n y = f(y) end % y is f^10(x)

21 jours ago | 1

| accepted

Answered

How to uniformly sample the surface of a sphere?

There are few methods avialable on File exchange such as this one.

How to uniformly sample the surface of a sphere?

There are few methods avialable on File exchange such as this one.

21 jours ago | 1

| accepted

Answered

How to find all possible paths from point A to B in any direction in a matrix?

Tiny matrix of size 4 x 3. All paths of two opposite corners: 38 paths for 4-connectivity, 2922 paths for 8-connectivity c...

How to find all possible paths from point A to B in any direction in a matrix?

Tiny matrix of size 4 x 3. All paths of two opposite corners: 38 paths for 4-connectivity, 2922 paths for 8-connectivity c...

22 jours ago | 1

Answered

finding the unknowns in a matrix

More "robust" method [~,~,V] = svd(B); D1 = V(:,end); D1 = D1/D1(1);

finding the unknowns in a matrix

More "robust" method [~,~,V] = svd(B); D1 = V(:,end); D1 = D1/D1(1);

22 jours ago | 0

| accepted

Answered

finding the unknowns in a matrix

[~,R,P] = qr(B); D1 = P*[R(1:end-1,1:end-1)\R(1:end-1,end); -1]; D1 = D1/D1(1)

finding the unknowns in a matrix

[~,R,P] = qr(B); D1 = P*[R(1:end-1,1:end-1)\R(1:end-1,end); -1]; D1 = D1/D1(1)

23 jours ago | 0

Answered

Finding a row in a matrix that is closest to two separate conditions

Assuming the data is in yourarr rx = yourarr(:,5); iy = yourarr(:,6); z = rx + 1i*iy; ztarget = 1; [absdz, locmin] = min(ab...

Finding a row in a matrix that is closest to two separate conditions

Assuming the data is in yourarr rx = yourarr(:,5); iy = yourarr(:,6); z = rx + 1i*iy; ztarget = 1; [absdz, locmin] = min(ab...

24 jours ago | 0

Answered

Largest Value from the Row Sums of A

Initialize with Largest = -Inf % and not 0

Largest Value from the Row Sums of A

Initialize with Largest = -Inf % and not 0

24 jours ago | 0

| accepted

Answered

Is there a faster way to run my code?

For binary arrays r=rand(50,8)>0.5; C=rand(60,8)>0.5; [dmin, index_hard] = min(sum(xor(r,permute(C,[3 2 1])),2),[],3); ind...

Is there a faster way to run my code?

For binary arrays r=rand(50,8)>0.5; C=rand(60,8)>0.5; [dmin, index_hard] = min(sum(xor(r,permute(C,[3 2 1])),2),[],3); ind...

24 jours ago | 0

Answered

Diagonal slices of 3D array

[I,J] = ndgrid(1:N); D1 = zeros(2*N,N); D1(sub2ind(size(D1),I,J)) = C(sub2ind(size(C),I,J,J)); D2 = zeros(2*N,N); D2(sub...

Diagonal slices of 3D array

[I,J] = ndgrid(1:N); D1 = zeros(2*N,N); D1(sub2ind(size(D1),I,J)) = C(sub2ind(size(C),I,J,J)); D2 = zeros(2*N,N); D2(sub...

25 jours ago | 0

Answered

Is there any MATLAB toolbox that can find the local MAX of a piece-wise multi-variable function?

fmincon and friends if you have the toolbox.

Is there any MATLAB toolbox that can find the local MAX of a piece-wise multi-variable function?

fmincon and friends if you have the toolbox.

26 jours ago | 1

Answered

How to perform logical AND on intervals of contiguous locations

x = logical([0, 1, 0,0, 1,1, 0,0,0, 1,1,1, 0]) y = logical([0, 1, 1,0, 1,1, 0,1,0, 1,0,1, 0]) code without loop or groupping, ...

How to perform logical AND on intervals of contiguous locations

x = logical([0, 1, 0,0, 1,1, 0,0,0, 1,1,1, 0]) y = logical([0, 1, 1,0, 1,1, 0,1,0, 1,0,1, 0]) code without loop or groupping, ...

27 jours ago | 0

| accepted

Answered

Create 9x9 matrix with RANDI between [0,2] with each 0,1, and 2 repeating three times each per column.

[~,A] = sort(rand(9)); A = mod(A,3)

Create 9x9 matrix with RANDI between [0,2] with each 0,1, and 2 repeating three times each per column.

[~,A] = sort(rand(9)); A = mod(A,3)

28 jours ago | 1

Answered

performing a least squares with regularisation in matlab

Simpless method: n = size(X,2); % 8 lambda = 1e-6; % <= regularization parameter, 0 no regularization, larger value stronger r...

performing a least squares with regularisation in matlab

Simpless method: n = size(X,2); % 8 lambda = 1e-6; % <= regularization parameter, 0 no regularization, larger value stronger r...

28 jours ago | 0

Answered

Generate random sequence number with condition

P=interp1([0 0.9 1],[0.1 2 3.5],'pchip','pp'); n = 1e6; % 200 in your case % here is the array of random r=ppval(P,rand(1,n))...

Generate random sequence number with condition

P=interp1([0 0.9 1],[0.1 2 3.5],'pchip','pp'); n = 1e6; % 200 in your case % here is the array of random r=ppval(P,rand(1,n))...

28 jours ago | 0

| accepted

Answered

Is there a faster way to run my code?

Use knnsearch if you have the right toolbox (I don't so the code is untested) [index_hard, dist_hard] = knnsearch(C,r,'K',1,'Di...

Is there a faster way to run my code?

Use knnsearch if you have the right toolbox (I don't so the code is untested) [index_hard, dist_hard] = knnsearch(C,r,'K',1,'Di...

28 jours ago | 0

Answered

Can someone provide me the theory and math behind this function of eigen?

for each column number j, A*V = B*V*D implies A*xj = lambdaj*B*xj where xj = V(:,j) lambdaj = D(j,j) This is just a gene...

Can someone provide me the theory and math behind this function of eigen?

for each column number j, A*V = B*V*D implies A*xj = lambdaj*B*xj where xj = V(:,j) lambdaj = D(j,j) This is just a gene...

28 jours ago | 0

| accepted

Answered

Is there any method to accelerate many small matrix and vector's "mldivide" (4*4)?

Use my FEX file of MultiSolver num = 4000000; A = rand(4,4,num); b = rand(4,num); x = zeros(4,num); tic for i=1:num ...

Is there any method to accelerate many small matrix and vector's "mldivide" (4*4)?

Use my FEX file of MultiSolver num = 4000000; A = rand(4,4,num); b = rand(4,num); x = zeros(4,num); tic for i=1:num ...

28 jours ago | 0

Answered

How do I swap the elements in the major diagonal with those in the minor diagonal?

x=[1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2] s=size(x); m=min(s); n=s(2); i=1:m; id=sub2ind(s,i,i); iad=sub2ind(s,i,n+...

How do I swap the elements in the major diagonal with those in the minor diagonal?

x=[1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2] s=size(x); m=min(s); n=s(2); i=1:m; id=sub2ind(s,i,i); iad=sub2ind(s,i,n+...

29 jours ago | 1

Answered

Efficiently calculating sum-thresholds across vector

This works regardless the sign of sample % Test data samples = 5*rand(1,10000); samples = samples+0.5*randn(size(samples)); %...

Efficiently calculating sum-thresholds across vector

This works regardless the sign of sample % Test data samples = 5*rand(1,10000); samples = samples+0.5*randn(size(samples)); %...

29 jours ago | 0

Answered

Find min and max of consecutive values in an array and save these values in a nx2 matrix

v = [670; 671; 672; 680; 681; 682; 700; 701; 702; 703] idx = find([true; diff(v(:))~=1; true]); minmaxseq = [v(idx(1:end-1))...

Find min and max of consecutive values in an array and save these values in a nx2 matrix

v = [670; 671; 672; 680; 681; 682; 700; 701; 702; 703] idx = find([true; diff(v(:))~=1; true]); minmaxseq = [v(idx(1:end-1))...

29 jours ago | 2

| accepted

Answered

Isolate first non-zero integer of each element of an array

A = [0.00663270674527115 36798861787.4757 0.0165559157141383 0.00845305563147772 0.000298646998074807 2561194549424.91]...

Isolate first non-zero integer of each element of an array

A = [0.00663270674527115 36798861787.4757 0.0165559157141383 0.00845305563147772 0.000298646998074807 2561194549424.91]...

29 jours ago | 1

| accepted

Answered

Circulant Matrix [Column Wise Traversal]

function C= circulant(x) n=length(x); C=zeros(n,n); C(:,1)=x; for j=2:n C(:,j)=[C(n,j-1); C(1:n-1,j-1)]; end

Circulant Matrix [Column Wise Traversal]

function C= circulant(x) n=length(x); C=zeros(n,n); C(:,1)=x; for j=2:n C(:,j)=[C(n,j-1); C(1:n-1,j-1)]; end

environ un mois ago | 0

| accepted

Answered

Circulant Matrix [Column Wise Traversal]

function C= circulant(x) n = length(x); C = x(mod((1:n)'-(1:n),n)+1);

Circulant Matrix [Column Wise Traversal]

function C= circulant(x) n = length(x); C = x(mod((1:n)'-(1:n),n)+1);

environ un mois ago | 0

Question

Memory leak with OPENGL hardware

Context: I have a matlab code that output a complex 3D graphic animation on GUI figure, involving patch, lines, markers, camera ...

environ un mois ago | 0 answers | 0

Answered

Obtain all integer partitions for a given integer

I wrote a short function that doesn't need to post-proceesed with UNIQUE (wast of time and memory) when using with NSUMK or allv...

Obtain all integer partitions for a given integer

I wrote a short function that doesn't need to post-proceesed with UNIQUE (wast of time and memory) when using with NSUMK or allv...

environ un mois ago | 0

Answered

Circulant Matrix [Column Wise Traversal]

function C= circulant(x) toeplitz(x,circshift(flip(x),1)) end

Circulant Matrix [Column Wise Traversal]

function C= circulant(x) toeplitz(x,circshift(flip(x),1)) end

environ un mois ago | 0

Answered

Set all elements of a sparse matrix to zero

B(:) = 0; C(:) = 0;

Set all elements of a sparse matrix to zero

B(:) = 0; C(:) = 0;

environ un mois ago | 0

| accepted