I'm trying to get various angles (theta in blue on the picture) along with the length of the lines (the red dot is the end point from zero) See pic below
Please note I'm trying to get more than just one angle and more than just one length from zero, I plan on making a function where I will get the angle or length of the line if I put in a given angle or given length.
I'm trying to recreate the picture above using parametric form, I was following the instructions from this website http://www.intmath.com/blog/golden-spiral/6512?PageSpeed=noscript But it doesn't seem to be working out. The main goal is to get the various angles along with the length of the lines from zero.
The code along with the plot I have is below
clear all, clc, clf
%find how many angles to make one full cycleremeber to divide by two if using stereo signal 180 out of phase
incr=20;
angle_wanted=incr;
n = lcm(360, 180 - angle_wanted) / (180 - angle_wanted)
angle_div=[0:incr:incr*n] %angle divsions
angle_div_mod=mod(angle_div,360) %angle divsions mod into 360
angle_div_mod_opp=mod(angle_div+180,360) %oppsite angle divsions mod into 360
%for circles
r= 2.2;
for rho = 0:0.1:2
[x1,y1] = pol2cart( 0:0.01:2*pi , rho);
plot(x1,y1,'b')
axis(1.10*[-r r -r r])
axis equal
hold on;
end
%for orig angles
for ii=1:n
angle=angle_div(ii)
[x1,y1] = pol2cart( angle / 180 * pi , [0 2]);
plot(x1,y1,'r')
hold on;
title_h=title(['Norig= ', int2str(ii)]);
%title_h = title('This is the title');
set(title_h, 'Position', [0.5, 0.02],'VerticalAlignment', 'bottom', 'HorizontalAlignment', 'left')
%%for creating orig angles
idx=angle_div_mod(ii);
text(r*cos(pi*idx/180),r*sin(pi*idx/180),num2str(idx), 'HorizontalAlignment','center', 'color',[1 .5 0])
pause (.1)
end
%for oppsite angles
for ii=1:n
angle_opp=angle_div_mod_opp(ii)
[x1,y1] = pol2cart( angle_opp/ 180 * pi , [0 2]);
plot(x1,y1,'g')
hold on;
title(['Nopp= ', int2str(ii)]);
%for creating oppsite angles
idx=angle_div_mod_opp(ii);
text(r*cos(pi*idx/180),r*sin(pi*idx/180),num2str(idx), 'HorizontalAlignment','center', 'color',[.5 .7 .7])
pause (.1)
end
t = linspace(0,5*pi,1000);
r=e^0.30635*t;
x = r.*cos(t);
y = r.*sin(t);
plot(x,y)
with use of
patch
you will get,[r(t),t]
are length and angles.