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

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 0

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

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 1

| aceptada

Respondida
Compare values in a matrix and keep the lowest number in each element?
Assuming they are the same size min(A,B)

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 0

| aceptada

Respondida
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

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 0

Respondida
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')

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 0

| aceptada

Respondida
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

casi 7 años hace | 0

Respondida
unique elliptic curve points
use UNIQUE command

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 1

Pregunta


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

casi 7 años hace | 1 respuesta | 1

1

respuesta

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

casi 7 años hace | 1

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

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 2

| aceptada

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

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 1

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

casi 7 años hace | 0

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

casi 7 años hace | 0

| aceptada

Respondida
Combining sub-matrices diagonally within a for loop
submats = arrayfun(@(n) 2*(1:n)'+(1:n),[3 1 2],'unif',0) matrix = blkdiag(submats{:})

casi 7 años hace | 0

| aceptada

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

casi 7 años hace | 1

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

casi 7 años hace | 0

Cargar más