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


Torsten
Posts:
1,703
Registered:
11/8/10


Re: Spiral with constant velocity (same distance betwee coordinate)
Posted:
Feb 26, 2013 2:31 AM


"Markus Due Jakobsen" wrote in message <kggme8$5ak$1@newscl01ah.mathworks.com>... > 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
Given a point on the spiral (t0*cos(t0)*Width,t0*sin(t0)*Width), the distance squared to another point on the spiral is given by d^2=(t*cos(t)*Widtht0*cos(t0)*Width)^2 + (t*sin(t)*Widtht0*sin(t0)*Width)^2. This is a quadratic equation in t you can solve analytically.
Best wishes Torsten.



