
The Archimedean spiral is a spiral named after the Greek mathematician Archimedes.



An Archimedean spiral can be described by the equation:






r
=
a
+
b
θ


{\displaystyle \,r=a+b\theta }


with real numbers a and b.



Task
Draw an Archimedean spiral.




a = 3;
b = 2;
 
theta = linspace(0,10*%pi,1000);
r = a + b .* theta;
 
//1. Plot using polar coordinates
scf(1);
polarplot(theta,r);
 
//2. Plot using rectangular coordinates
//2.1 Convert coordinates using Euler's formula
z = r .* exp(%i .* theta);
x = real(z);
y = imag(z);
 
scf(2);
plot2d(x,y);