Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Spiral with constant velocity (same distance betwee coordinate)
Posted:
Feb 25, 2013 4:52 PM


Hi Josh
Thanks for your reply. I want to create a spiral with constant distance (let's say 20) between each sample (coordinates).
Num = 1000; Rad = 20*pi; Width = 10; t = linspace(0,1,Num); tRad = t.*Rad; x = (tRad.*cos(tRad)*Width); y = (tRad.*sin(tRad)*Width);
y(y>0)=y(y>0)*1.6; % multiply positive Y's with 1.6 figure(1); plot(x,y)
% Calculating the distance between each sample dX=diff(x); dY=diff(y); vec=[dX; dY]'; Distance = sqrt(vec(:,1).^2 + vec(:,2).^2); figure(2); plot(Distance)
% I want the distance to be 20. How do I correct for this in my example?
Markus
"Josh Meyer" <jmeyer@mathworks.com> wrote in message <kgg3gb$t2k$1@newscl01ah.mathworks.com>... > It looks like if you try to scale y in that way (positive y values > multiplied by 1.6), you get a very strange looking graph that no longer has > constant velocity. >  > Num = 1000; Rad = 20*pi; Width = 10; > t = linspace(0,1,Num); > tRad = t.*Rad; > x = (tRad.*cos(tRad)*Width); > y = (tRad.*sin(tRad)*Width); > > for i=1:length(y) > if y(i)>0 > y(i)=1.6*y(i) > end > end > plot(x,y) >  > In general the 'b' parameter in the spiral equation r = a + b*theta^(1/n) > controls the distance between turns, n=1 makes it Archimedean (constant > velocity), and a 'turns' the spiral. If you post more about what your task > is I could say more.. > Josh > > "Markus Due Jakobsen" <markusdue@gmail.com> wrote in message > news:kgg0iu$j12$1@newscl01ah.mathworks.com... > > Hi > > I have a problem creating a spiral with constant velocity (same distance > > between coordinates not constant angular velocity). > > > > These lines of code should create a spiral with constant angular velocity: > > Num = 1000; Rad = 20*pi; Width = 10; > > t = linspace(0,1,Num); > > tRad = t.*Rad; > > x = (tRad.*cos(tRad)*Width); y = (tRad.*sin(tRad)*Width); > > > > These lines creates a spiral with almost constant velocity: > > Num = 1000; Rad = 20*pi; Width = 10; > > t = linspace(0,1,Num).^0.5; > > tRad = t.*Rad; > > x = (tRad.*cos(tRad)*Width); y = (tRad.*sin(tRad)*Width); > > > > However, I want to create a spiral with constant velocity (constant > > distance between the coordinates) and I want to be able to change the > > amplitudes (i.e. y>0 coordinates should be multiplied by 1.6) without > > changing the velocity. Any Ideas on how to do this? > > > > Kind regards Markus



