Use element-wise operations (the ‘dot operator’):
x=e*cos(theta)./sqrt(4/3+4/3*cos(theta).*sin(theta));
y=e*sin(theta)./sqrt(4/3+4/3*cos(theta).*sin(theta));
That worked when I ran it.
EDIT —
You can plot them all at the same time (without loops) by using matrix operations as well as element-wise (array) operations:
theta=0:0.1:(2*pi);
e=[0.1; 0.2; 0.3; 0.4];
x=e*cos(theta)./sqrt(4/3+4/3*cos(theta).*sin(theta));
y=e*sin(theta)./sqrt(4/3+4/3*cos(theta).*sin(theta));
plot(x.',y.')
.
Best Answer