I don't know if this is the right forum but
I am trying to code a rotating vector v by an angle theta anticlockwise n times around a circle. Afterwards, set a variable r to be the number of these n+1 vectors that are within (strictly less than) distance d of vector w.
So far what I've done is times (n+1) by the rotational vector [cos(theta),-sin(theta);sin(theta),cos(theta)] with vector v.
So
a=(n+1)*[cos(theta),-sin(theta);sin(theta),cos(theta)]*v;
I know I have to somehow incorporate norm(a-w) <= w or something as that gives the distance between the two vectors but I'm kind of stuck on how to do so.
Alternatively, I am also thinking that instead of times'ing by (n+1), I'm thinking that maybe it's wrong and that I have to make a loop like for n=1,2,...,k, if this vector is within norm(a - w) < d then sum, else disregard or something.
This would be easy if it was manual as it would only require multiplying the rotational vector by v and find the distance between the new rotated vector and vector w, and repeat it again for however many n's but I am having trouble coding this.
Any help would be appreciated
r = 0; v=v; if norm(v-w) < d; r=r+1; end for k=1:n v = A*v; if norm(v-w) < d r = r + 1;
end```
– i9-9980XE Apr 28 '19 at 22:58