Answered
implementation of a matrix
n = 3; x = rand(n+1,1); A = cumprod([ones(size(x)), (x-x(1:end-1).')], 2)

6 years ago | 0

Answered
Find indices of elements for given difference
i = interp1(t, 1:length(t), 0:10:max(t), 'nearest', 'extrap');

6 years ago | 0

Answered
Matlab app designer gets stuck when enlarging figure (dynamic simulation)
When you enlarge the figure, a resize function is called to update and propagate the new size to various graphic object. This i...

6 years ago | 0

Answered
Regridding 2D-grid shuffled points from 1-D arrays
A single SORTROWS command will undo the shuffle xyz_grid = sortrows([x(:) y(:) z(:)],[1 2]); ny = find(diff(xyz_grid(:,1)),1...

6 years ago | 0

| accepted

Answered
Alternatives to using ismember() for string versus cell array of strings
In general my preference is "any(strcmp(s,cellchar))". I'm not sure if I did some benchmark to come to this conclusion, what I k...

6 years ago | 3

| accepted

Answered
Implementation of a matrix
n=3; >> x=ceil(5*rand(1,n+1)) x = 3 5 1 3 >> M=fliplr(vander(x)) M = 1 3 9 27...

6 years ago | 0

| accepted

Answered
Creating permutations from rows of a matrix
This question is almost like what you ask in this thread Only the formating of the input is different (in one case you split t...

6 years ago | 0

| accepted

Answered
Need to create all possible sequences
X1=[2-i 3+4i 5+7i]; X2=[7+8i 4-9i 7+9i]; X3=[2+i 4+8i 3-9i]; P=cell2mat(perms({X1 X2 X3})) % Each row of P is a combined "sequ...

6 years ago | 1

| accepted

Answered
sum() function gives error
You have created a variable named SUM in your workspace that shadows MATLAB stock function SUM.

6 years ago | 1

Answered
mxCreateNumericMatrix and sparse matrix in C/Matlab hybrid programming
I am not sure whether I create the matrices MI and MJ wrongly, or Matlab does not support sparse operation in this manner. The...

6 years ago | 0

| accepted

Answered
how to give the lines color based on the distanse
% Generate 20 functions x=linspace(0,2*pi,200)'; A=linspace(0.2,1,20); y=A.*(sin(x).*exp(-x/2)); r=sqrt((x-pi).^2+(y).^2);...

6 years ago | 0

Answered
Properties of adjacency matrix
Checkout conncomp

6 years ago | 0

Answered
mapping of datas in -pi to pi to 0 to 2*pi
data_0_2pi = mod(data,2*pi) the domain of data does not matter actually.

6 years ago | 0

Answered
Is there faster way to apply `det` function along the third dimension?
Similar question addressed here I would note that Walter's solution that use recursive formal determinant formula might be fast...

6 years ago | 1

| accepted

Answered
Rearranging rows of a boolean matrix so that the diagonals are all non-zero if possible
Your problem belong to the so-called "Assignment problem", that has dedicated algorithm called Hungarian assigment. Take a look...

6 years ago | 1

Answered
How to find volume under 2D data?
% Generate some fake data, replace r with your X and y with your Y vector % you need to peak either side r >= 0 or r <= 0 NOT b...

6 years ago | 0

Answered
Vectorization of while loop
meanValue = 10; devValue = 1; numValues = 1000000; presumption = 2; tic % Function from here https://www.mathworks.com/...

6 years ago | 0

| accepted

Answered
Create random graph with limited degree
n = 10; % number of nodes maxDeg = 4; M=rand(n); M=0.5*(M+M'); S1=sort(M,1,'descend'); S2=sort(M,2,'descend'); T=max(S1(...

6 years ago | 0

| accepted

Answered
Remove array values with multiple occurances from "parent" array
Test samples a = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] b = [1, 1, 2, 4, 4, 4] Code u = unique([a,b]); n = length(u); [~, ia...

6 years ago | 0

Answered
Create all unique combination with a vector array
Try this, no redundancy created. However the number of combinations still grow very quick so be awared. Where as it gives the or...

6 years ago | 1

| accepted

Answered
Explain weird MATLAB behavior
It's a SPARSE matrix

6 years ago | 1

| accepted

Answered
Does anyone know how to use the matlab to calculate the minimu distance between a point outside oval and the oval surface?
Checkout this FEX https://www.mathworks.com/matlabcentral/fileexchange/27711-euclidian-projection-on-ellipsoid-and-conic

6 years ago | 1

Submitted


Distance bewteen 2 cylinders in 3D
Compute the distances between 2 cylinders in 3D as well as the closest points

6 years ago | 1 download |

5.0 / 5
Thumbnail

Question


select cameratoolbar by axes
When using standard zoom/pan/rotate3D we can disable the axes that would not under the interaction with user by setAllowAxesZoo...

6 years ago | 0 answers | 0

0

answers

Answered
Modular arithmetic for encryption
"1/2" is integer (let us call it "a") so that a*2 = 1 mod 29 This can be obtained by GCD function >> [~,a]=gcd(2,29) a = ...

6 years ago | 1

| accepted

Answered
Bug with conv2
The answer is correct. May be you expect the result with sliding sum with unflip kernel which is of course wrong.

6 years ago | 1

Answered
How to replace for loop with vectorization?
[iii,jj]=ndgrid(ii,1:size(res,2)); v=accumarray([iii(:) jj(:)], res(:))

6 years ago | 1

Answered
Generate a random matrix without repeating any value in row and column.
A=mod((0:3)+(0:3)',4)+1; R=A(randperm(end),randperm(end))

6 years ago | 0

| accepted

Answered
Getting back the solution to Ax=b after reordering A
This is correct: clc clear close all A=[4 1 2 0.5 2;1 0.5 0 0 0;2 0 3 0 0;0.5 0 0 5/8 0;2 0 0 0 16]; % P_amd=amd(A); P_amd...

6 years ago | 0

Load more