Please help me with this.
I need to code into matlab a function that results in a matrix answer.
It is this:
phi(i,j)=atan((eta(j)eta(i))/(zeta(j)zeta(i)))*180/pi]
Here is my code so far:
for i=1:4;
N=4;
w(i)=(360/N)*(i0.5);
x(i)=cos(w(i)*pi/180);
y(i)=sin(w(i)*pi/180);
x(5)=x(1);
y(5)=y(1);
zeta(i)=0.5*(x(i)+x(i+1));
eta(i)=0.5*(y(i)+y(i+1));
theta(i)=atan2((y(i+1)y(i)),(x(i+1)x(i)))*180/pi;
s(i)=sqrt((x(i+1)x(i))^2+(y(i+1)y(i))^2);
if theta(i)<0;
theta(i)=theta(i)+360;
end
j=1:4;
phi(i)=[atan((eta(i:N)eta(i:N))/(zeta(i:N)zeta(i:N)))*180/pi];
end

See I need a 4X4 matrix for phi.
I only have four etas and four zetas. both i and j = 4. With some work I can get a 4x4 matrix but it isn't coded right. It gives me the same answers in rows. It should have a diagonal line of zero's from top left to bottom right because that is where i=j
And I need to be able to change N to 250 so it needs to be easy to write for large N's
Thank you for your help!