Answered

How to correctly calculate the angle between two planes?

One time I get 2.68555450304481 and if I change the order of input I get 0.456276904837795 !! What am I missing? Isn't an angl...

How to correctly calculate the angle between two planes?

One time I get 2.68555450304481 and if I change the order of input I get 0.456276904837795 !! What am I missing? Isn't an angl...

alrededor de 4 horas ago | 0

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

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

alrededor de 5 horas ago | 0

Answered

Vectorization of while loop

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

Vectorization of while loop

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

alrededor de 12 horas 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(...

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

3 días 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...

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 días 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...

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

7 días ago | 0

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

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

11 días ago | 1

Submitted

Distance bewteen 2 cylinders in 3D

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

7 meses ago | 1 download |

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

8 meses ago | 0 answers | 0

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

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

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

Bug with conv2

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

9 meses ago | 1

Answered

How to replace for loop with vectorization?

[iii,jj]=ndgrid(ii,1:size(res,2)); v=accumarray([iii(:) jj(:)], res(:))

How to replace for loop with vectorization?

[iii,jj]=ndgrid(ii,1:size(res,2)); v=accumarray([iii(:) jj(:)], res(:))

9 meses 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))

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

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

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

9 meses ago | 0

Answered

how can i generate the random numbers for specific probabilites

v = [ 0, 15, 25, 35, 45, 20]; % values P = [0.01, 0.15, 0.20, 0.50, 0.12, 0.02]; % the correspond probability c ...

how can i generate the random numbers for specific probabilites

v = [ 0, 15, 25, 35, 45, 20]; % values P = [0.01, 0.15, 0.20, 0.50, 0.12, 0.02]; % the correspond probability c ...

9 meses ago | 0

| accepted

Answered

combination and their sum

A = [4 2; 5 7; 3 1] m = size(A,1); b = dec2bin(0:2^m-1,m)-'0'; C = A((1:m)+m*b).' Result (each column is a co...

combination and their sum

A = [4 2; 5 7; 3 1] m = size(A,1); b = dec2bin(0:2^m-1,m)-'0'; C = A((1:m)+m*b).' Result (each column is a co...

9 meses ago | 0

Answered

How to calculate determinant of matrices without loop?

a(:,1).*b(:,2)-a(:,2).*b(:,1)-a(:,1).*b(:,3)+a(:,3).*b(:,1)+a(:,2).*b(:,3)-a(:,3).*b(:,2)

How to calculate determinant of matrices without loop?

a(:,1).*b(:,2)-a(:,2).*b(:,1)-a(:,1).*b(:,3)+a(:,3).*b(:,1)+a(:,2).*b(:,3)-a(:,3).*b(:,2)

9 meses ago | 1

| accepted

Answered

Equality constraint in quadratic programming

Yes, il looks right to me. EDIT: No Q(3,1) must be 0 Q=[2 1 0; 1 4 0 ; 0 0 6]

Equality constraint in quadratic programming

Yes, il looks right to me. EDIT: No Q(3,1) must be 0 Q=[2 1 0; 1 4 0 ; 0 0 6]

9 meses ago | 0

| accepted

Answered

Find matching points from two coordinate systems

Look for the literature of image registration. For simple rotation/scaling/translation you can use Matt J's submission For mo...

Find matching points from two coordinate systems

Look for the literature of image registration. For simple rotation/scaling/translation you can use Matt J's submission For mo...

9 meses ago | 0

Answered

How vectorize this operation

n=10 m=3 x=rand(n,1) y=rand(m,1) % your method z = nan(length(x),1);% Just some fake data to define the size of z. could ...

How vectorize this operation

n=10 m=3 x=rand(n,1) y=rand(m,1) % your method z = nan(length(x),1);% Just some fake data to define the size of z. could ...

9 meses ago | 1

| accepted

Answered

Solve Overdetermined Linear System

For overdetermined system the "\" returns least-square solution, meaning it doesn't solve exactly your system, but returnes the ...

Solve Overdetermined Linear System

For overdetermined system the "\" returns least-square solution, meaning it doesn't solve exactly your system, but returnes the ...

9 meses ago | 0

Answered

How to remove duplicates in matrix with condition

X = [1 10;2 20;3 30;3 31;3 32]; Xs=sortrows(X); [~,I]=unique(Xs(:,1),'last'); XResult = Xs(I,:)

How to remove duplicates in matrix with condition

X = [1 10;2 20;3 30;3 31;3 32]; Xs=sortrows(X); [~,I]=unique(Xs(:,1),'last'); XResult = Xs(I,:)

9 meses ago | 1

| accepted

Answered

How to taker power of a permutaion matrix

You have 2 ways to compute it, from the permutation itself, or using the permutation matrix then raise a power of it. % Generat...

How to taker power of a permutaion matrix

You have 2 ways to compute it, from the permutation itself, or using the permutation matrix then raise a power of it. % Generat...

10 meses ago | 0

| accepted

Answered

How to design a Toeplitz matrix with negative lower triangle elements and zero main diagonal elements

toeplitz(0:-1:-5,0:5)

How to design a Toeplitz matrix with negative lower triangle elements and zero main diagonal elements

toeplitz(0:-1:-5,0:5)

10 meses ago | 1

| accepted

Answered

How to define a covariance matrix that is positive semi definite?

L=randn(3); sigma=L'*L

How to define a covariance matrix that is positive semi definite?

L=randn(3); sigma=L'*L

10 meses ago | 0

Question

path of a mfile not on search path

When an mfile is not on the search path or current path and when user types the name, MATLAB find it and issues a suggestion >>...

10 meses ago | 2 answers | 0

Answered

How to generate a random data vector that follows a constraint

This will generate uniform distribution (within to polytope) N = 10; Etotal = 0; E = -log(rand(N+1,1)); E = E(1:N,:)./sum(...

How to generate a random data vector that follows a constraint

This will generate uniform distribution (within to polytope) N = 10; Etotal = 0; E = -log(rand(N+1,1)); E = E(1:N,:)./sum(...

10 meses ago | 2

| accepted

Answered

Increasing Java Heap Memory of target machine so that EXE runs on target machine with MCR

According to my test, the stand alone app uses the sames amount of java heap memory than your MATLAB preferences. To set the a...

Increasing Java Heap Memory of target machine so that EXE runs on target machine with MCR

According to my test, the stand alone app uses the sames amount of java heap memory than your MATLAB preferences. To set the a...

10 meses ago | 0

| accepted

Answered

Model of a crowd on concert venue or how to distribute random points according to the 2D window distribution

Torsten's rejection might bias the distribution. One of the better approach is to repell the points when they are close to each...

Model of a crowd on concert venue or how to distribute random points according to the 2D window distribution

Torsten's rejection might bias the distribution. One of the better approach is to repell the points when they are close to each...

10 meses ago | 0