Code covered by the BSD License

### Highlights from Minkowski Sum

5.0
5.0 | 1 rating Rate this file 13 Downloads (last 30 days) File Size: 1.65 KB File ID: #34125

# Minkowski Sum

### Mike Sheppard (view profile)

08 Dec 2011 (Updated )

Minkowski sum of two arrays

File Information
Description

S=MINKSUM(A,B) produces the Minkowski sum of two sets A and B in Euclidean space, the result being the addition of every element of A to every element of B.

[S,D]=MINKSUM(A,B) returns the Minkowski sum S, and also the multiplicity of each element in S.

The number of columns represent the dimensionality. An array of M points in N-D space is an MxN array. A vector of 1D values is a column vector.

If the sizes of A and B are MAxN and MBxN respectively, then the size of S will be at most (MA*MB)xN

Example:
A=[1 1; 2 1; 2 2; 1 2]; B=[3 3; 4 3; 4 4; 3 4];
[S,D]=minksum(A,B);
plot(A(:,1),A(:,2),'*',B(:,1),B(:,2),'s',S(:,1),S(:,2),'d')
axis([0 7 0 7])

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Comments and Ratings (2)
04 Sep 2013 Samuel Cole

### Samuel Cole (view profile)

Alex,
Columns add dimensions, rows add cardinality. You want:

minksum([1;2],[6;7])

ans =

7
8
9

15 May 2013 Alex Dytso

### Alex Dytso (view profile)

I don't think that your code works.
Try this:

X2=[1 2]
X2 = 1 2
>> X1=[ 6 7]
X1 = 6 7
>> minksum(X1,X2)
ans =7 9

the answer should be 7 8 9

Comment only