clc clear clear all for i=1:4 cteta(i)=cos(((i-1)*pi)/(2)); steta(i)=sin(((i-1)*pi)/(2)); end a=[2 2 4 4]; b=perms(a); for j=1:24 b1=b(j,:); k=b1'; fx(j)=cteta*k; fy(j)=steta*k; f(j)=sqrt((fx(j)^2)+(fy(j)^2)); end f y=min(f) [n,m]=find(f==y)