Hello, I need from an array consisting of 10,000 items and are the coordinates (X and Y) of the ellipse to determine the minimum and maximum distance between two points. The problem is that the origin of 10000 should have 9999 range, the mine, the program calculates only 9998. you can verify using the command size(dist).
clear allclcA=[2/3 -2/3; 2/3 7/3]; [eigenvektor, eigenvalue]=eig(A); n = 10000; theta = linspace(0,2*pi,n); r = 1; x =r.*cos(theta); y =r.*sin(theta); plot(x,y,'.') v = [x;y]; w=A*v;xcoor=w(1,:);ycoor=w(2,:);i=0;while i<ni=i+1;dxx2=xcoor(n-i:length(xcoor)-i);dxx1=xcoor(n-(i+1):length(xcoor)-(i+1));dyy2=xcoor(n-i:length(ycoor)-i);dyy1=xcoor(n-(i+1):length(ycoor)-(i+1));dist(i)=sqrt( (dxx2-dxx1)^2 + (dyy2-dyy1)^2);end
Best Answer