Answered

Creating a Helix Spiral

r = ... gap = ... t = (2*pi/gap)*(0:0.001:10); st = r*sin(t); ct = r*cos(t);

Creating a Helix Spiral

r = ... gap = ... t = (2*pi/gap)*(0:0.001:10); st = r*sin(t); ct = r*cos(t);

13 hours ago | 1

| accepted

Answered

Compare values in a matrix and keep the lowest number in each element?

Assuming they are the same size min(A,B)

Compare values in a matrix and keep the lowest number in each element?

Assuming they are the same size min(A,B)

15 hours ago | 1

| accepted

Answered

How to close the boundary of a surface already generated by filling the holes

Add the salt to suit your need % NOTE to MS KHAN not everybody own Excel license, please post data in MATFILE to % to facili...

How to close the boundary of a surface already generated by filling the holes

Add the salt to suit your need % NOTE to MS KHAN not everybody own Excel license, please post data in MATFILE to % to facili...

18 hours ago | 0

Answered

How to fill array of zeros with string

x = cell(5,1); for k =1:length(x) x(k) = {'load'}; end

How to fill array of zeros with string

x = cell(5,1); for k =1:length(x) x(k) = {'load'}; end

1 day ago | 0

| accepted

Answered

how can i generate random number divided by 0.25 from 0 to 10 for example(0.25,7.75,5.50,6.25 ,........)?

Generate 1000 of such numbers (randi(41,1,1000)-1)/4

how can i generate random number divided by 0.25 from 0 to 10 for example(0.25,7.75,5.50,6.25 ,........)?

Generate 1000 of such numbers (randi(41,1,1000)-1)/4

1 day ago | 2

| accepted

Answered

find row index if all column elements are known

If A is your array, for example A=ceil(10*rand(10000,3)) and you want to find [1,2,3] this command find(ismember(A,[1 2 3],'r...

find row index if all column elements are known

If A is your array, for example A=ceil(10*rand(10000,3)) and you want to find [1,2,3] this command find(ismember(A,[1 2 3],'r...

1 day ago | 0

Answered

How can I set the colors in the legend if I show a number of legend elements which is lower thatn the number of plotted functions?

h=bar(rand(10,3)) legend(h(1:3),'1','2','3')

How can I set the colors in the legend if I show a number of legend elements which is lower thatn the number of plotted functions?

h=bar(rand(10,3)) legend(h(1:3),'1','2','3')

3 days ago | 0

| accepted

Answered

Euclidean distance of adjacent pairs of matrix

All pairs If you have the right toolbox, take a look at PDIST2 function. If not [m,n] = size(A); D = sqrt(sum((reshape(A, [m,...

Euclidean distance of adjacent pairs of matrix

All pairs If you have the right toolbox, take a look at PDIST2 function. If not [m,n] = size(A); D = sqrt(sum((reshape(A, [m,...

3 days ago | 0

| accepted

Answered

how do I relate two arrays with a reference point ?

y=[1 2 3 5 7]; x= [-2 -1 0 1 2 ] nz = 2; % number of zeros to be inserted y(end+nz,:) = 0; y = y(1:end-nz) x = (0:length(y...

how do I relate two arrays with a reference point ?

y=[1 2 3 5 7]; x= [-2 -1 0 1 2 ] nz = 2; % number of zeros to be inserted y(end+nz,:) = 0; y = y(1:end-nz) x = (0:length(y...

3 days ago | 0

Answered

How to close the boundary of a surface already generated by filling the holes

You can use imclose (image processing toolbox required) https://fr.mathworks.com/help/images/ref/imclose.html

How to close the boundary of a surface already generated by filling the holes

You can use imclose (image processing toolbox required) https://fr.mathworks.com/help/images/ref/imclose.html

3 days ago | 0

Answered

How to generate matrices that satisfies constraints on sum of row elements and sum of column elements?

New code with speficied target row and col sum, using FEX randfixesum and requires optimization toolbox rs = [100; 200; 300] % ...

How to generate matrices that satisfies constraints on sum of row elements and sum of column elements?

New code with speficied target row and col sum, using FEX randfixesum and requires optimization toolbox rs = [100; 200; 300] % ...

3 days ago | 0

| accepted

Answered

How to use transpose in my graph?

Put this after imagesc command set(gca,'Ydir','normal') or imagesc(x,y,flipud(C) )

How to use transpose in my graph?

Put this after imagesc command set(gca,'Ydir','normal') or imagesc(x,y,flipud(C) )

4 days ago | 1

| accepted

Answered

How to generate all possible (10x10) matrices containing only 0s and 1s, along with other restrictions, for a Graph Theory application.

One simple thing you could do is move outt the while loop all the preparation step that compute variable that does change graph...

How to generate all possible (10x10) matrices containing only 0s and 1s, along with other restrictions, for a Graph Theory application.

One simple thing you could do is move outt the while loop all the preparation step that compute variable that does change graph...

4 days ago | 0

| accepted

Answered

How to generate all possible (10x10) matrices containing only 0s and 1s, along with other restrictions, for a Graph Theory application.

Here is working code that generate a random adjadcent matrix when allowing 4 nodes of degree 3 6 nodes of degree 6 to be comp...

How to generate all possible (10x10) matrices containing only 0s and 1s, along with other restrictions, for a Graph Theory application.

Here is working code that generate a random adjadcent matrix when allowing 4 nodes of degree 3 6 nodes of degree 6 to be comp...

4 days ago | 1

Question

Why INTLINPROG returns non-integer?

Why the solution of intlinprog is not integer? Few of many components returned are 0.5 despite being instructed as integer. loa...

4 days ago | 1 answer | 1

Answered

How to do discontinuous piecewise linear model fitting?

"Do you have any additional insights or comments on this approach on fitting models?" Well, I actually have problem to fit your...

How to do discontinuous piecewise linear model fitting?

"Do you have any additional insights or comments on this approach on fitting models?" Well, I actually have problem to fit your...

4 days ago | 1

Answered

How can I expand a array with with even zero intervals in between?

nz = 2; b = a; b(end+nz,:) = 0; b = b(1:end-nz)

How can I expand a array with with even zero intervals in between?

nz = 2; b = a; b(end+nz,:) = 0; b = b(1:end-nz)

5 days ago | 0

| accepted

Answered

Generating a select set of permutations

m = 17; nnz = 4; p=(nchoosek(1:m,nnz)); q=2*(dec2bin(0:2^nnz-1)-'0')-1; C=repelem(p,size(q,1),1); R=repmat((1:size(C,1))'...

Generating a select set of permutations

m = 17; nnz = 4; p=(nchoosek(1:m,nnz)); q=2*(dec2bin(0:2^nnz-1)-'0')-1; C=repelem(p,size(q,1),1); R=repmat((1:size(C,1))'...

5 days ago | 0

| accepted

Answered

consecutive combination of numbers from a list

>> (1:19)'+(0:2) % (1:m-n+1)'+(0:n-1) ans = 1 2 3 2 3 4 3 4 5 4 5 6...

consecutive combination of numbers from a list

>> (1:19)'+(0:2) % (1:m-n+1)'+(0:n-1) ans = 1 2 3 2 3 4 3 4 5 4 5 6...

5 days ago | 0

| accepted

Answered

Linprogr in Matlab not finding a solution when a solution exists

It looks to me LINPROG is flawed or buggy in your case. I try to remove suspected constraints and change beq so that the equalit...

Linprogr in Matlab not finding a solution when a solution exists

It looks to me LINPROG is flawed or buggy in your case. I try to remove suspected constraints and change beq so that the equalit...

5 days ago | 1

| accepted

Answered

Plot feasible region of a high-dimensional linear programming along some dimensions

Something is wrong in my implementation of understanding of your problem, but there is no feasible point found by my code. A=lo...

Plot feasible region of a high-dimensional linear programming along some dimensions

Something is wrong in my implementation of understanding of your problem, but there is no feasible point found by my code. A=lo...

6 days ago | 1

| accepted

Answered

Plot feasible region of a high-dimensional linear programming along some dimensions

What is your motivation to do that? You clearly underestimate such task, simply because the number of vertices of simplex grow ...

Plot feasible region of a high-dimensional linear programming along some dimensions

What is your motivation to do that? You clearly underestimate such task, simply because the number of vertices of simplex grow ...

6 days ago | 1

Answered

how to pick up all combination of numbers from multiple vectors

a=[1 2 3], b=[4 5 6 7], c=[8 9 10 11 12] C = {a,b,c}; % put you vectors here n = length(C); [C{:}] = ndgrid(C{:}); C = r...

how to pick up all combination of numbers from multiple vectors

a=[1 2 3], b=[4 5 6 7], c=[8 9 10 11 12] C = {a,b,c}; % put you vectors here n = length(C); [C{:}] = ndgrid(C{:}); C = r...

6 days ago | 0

Answered

What does ~ mean in an assignment when calling a function?

[~, J] = .... mean the first output is ignored by the caller (assigned to a garbage if you like). Even that syntax exists, I o...

What does ~ mean in an assignment when calling a function?

[~, J] = .... mean the first output is ignored by the caller (assigned to a garbage if you like). Even that syntax exists, I o...

7 days ago | 0

| accepted

Answered

Combining sub-matrices diagonally within a for loop

submats = arrayfun(@(n) 2*(1:n)'+(1:n),[3 1 2],'unif',0) matrix = blkdiag(submats{:})

Combining sub-matrices diagonally within a for loop

submats = arrayfun(@(n) 2*(1:n)'+(1:n),[3 1 2],'unif',0) matrix = blkdiag(submats{:})

7 days ago | 0

| accepted

Answered

Why is tic/toc not reporting the correct elapsed time?

I never have problem with tic/toc. I believe it inquires CPU frequency/counter or clock and derive time from it. It's very direc...

Why is tic/toc not reporting the correct elapsed time?

I never have problem with tic/toc. I believe it inquires CPU frequency/counter or clock and derive time from it. It's very direc...

7 days ago | 0

Answered

Calculating roll, pitch, and yaw from XYZ coordinates of 3 planar points?

You might use FEX by Matt to derive the translation/rotation (6DOfs), then compute the roll/pitch/yaw from the rotation matrix...

Calculating roll, pitch, and yaw from XYZ coordinates of 3 planar points?

You might use FEX by Matt to derive the translation/rotation (6DOfs), then compute the roll/pitch/yaw from the rotation matrix...

7 days ago | 0

Answered

Combine three matrices (every other column)

rfun = @(x) reshape(x,[1 size(x)]); D = reshape([rfun(A);rfun(B);rfun(C)],[],size(A,2)) The second method looks shorter but it...

Combine three matrices (every other column)

rfun = @(x) reshape(x,[1 size(x)]); D = reshape([rfun(A);rfun(B);rfun(C)],[],size(A,2)) The second method looks shorter but it...

7 days ago | 0

Answered

Expected one output from a curly brace or dot indexing expression, but there were 2 results.

In general you are not allow to assign multi-level structures with non-scalar indexing in one shot, you need to do in 2 steps. ...

Expected one output from a curly brace or dot indexing expression, but there were 2 results.

In general you are not allow to assign multi-level structures with non-scalar indexing in one shot, you need to do in 2 steps. ...

7 days ago | 1