Answered
random order of elements in array meeting some conditions
Dynamic programming rpermc() %% save the rest in rpermc.m if needed function r = rpermc() while true r = rpc([], 20:5...

7 years ago | 0

| accepted

Answered
Surface plots inside loop
Assuming your xdata and ydata are sorted. My code doest not make new resampling of x and y, or interpolation, I just stitch them...

7 years ago | 0

Answered
loosing quadrant data using atan2 when finding angle between 3 points (in 3D space) in MATLAB
You diagram looks like 2D and not 3D. In 3D you can turn around and look in opposite direction. The atan2 formula assume you lo...

7 years ago | 1

| accepted

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

7 years 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)

7 years ago | 1

| accepted

Answered
How to fill array of zeros with string
x = cell(5,1); for k =1:length(x) x(k) = {'load'}; end

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

7 years ago | 1

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

7 years ago | 0

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

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

7 years ago | 0

| accepted

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

7 years ago | 0

Answered
unique elliptic curve points
use UNIQUE command

7 years ago | 0

| accepted

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 EDIT: new code no longe...

7 years ago | 1

| accepted

Answered
How to use transpose in my graph?
Put this after imagesc command set(gca,'Ydir','normal') or imagesc(x,y,flipud(C) )

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

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

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

7 years ago | 1 answer | 1

1

answer

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

7 years 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)

7 years 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))'...

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

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

7 years ago | 2

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

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

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

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

7 years 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{:})

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

7 years ago | 1

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

7 years ago | 0

Load more