3
$\begingroup$

My problem is as follows. I am working on an experiment where I need to align a 3D vector with spherical coordinates $\vec{v} = (r, \phi, \theta)$ (red) to an infinite 1D line (blue). That line lies, at some unknown angle $\xi$, in an infinite 2D plane, with unknown vector span (green).

enter image description here

To do this alignment, I can independently vary $\phi$ and $\theta$ and measure some signal $S$. However, my 'vision' is limited; I have two 'signals' that I can measure, $S_P$ and $S_L$, where $S_P$ is maximal when the vector is in the plane and quickly reduces in visibility when it is not, and $S_L$ is maximal when the vector is parallel to the line, and quickly reduces in visibility when it is not. $S_L$ is thus very hard to use from a random starting vector; it pretty much only works when I am already in the plane. $S_L$ is less stringent; it is visible when you are close to being in plane, from which I generally start.

My idea is therefore as follows: in spherical coordinates I algorithmically control $\phi$ and $\theta$ while monitoring $S_P$, to find two vectors that span the plane. I use these two vectors to set up a new polar coordinate system of that plane, in which I can then sweep the polar angle to find $\xi$ and maximize $S_L$.

The second part should be trivial, but the first part is what my question is about. How do I algorithmically find two vectors that span the plane, controlling $\phi$ and $\theta$ and monitoring $S_P$?

As it currently stands I can find a single vector that works by simply varying $\phi$ and $\theta$ until $S_P$ reaches a maximum in both parameters simultaneously, but how do I go from there to find a linearly independent vector that is also in the plane? How should I algorithmically 'walk' through $\phi,\theta$ space to find that other vector? I say walk because what I envision the method to be like is that I start from the local maximum, 'overrotate' in $\theta$, bring $S_P$ back up with $\phi$ and overrotate, that one a bit, and then go back to theta and repeat. That will walk me through the angle space, but how I use this to find the second vector I don't see.

$\endgroup$
  • 1
    $\begingroup$ I deleted your first paragraph querying whether your question is on-topic, here. Your question is absolutely on-topic and it's the fact that you're asking for an algorithm not for code that makes it so. Welcome to the site! $\endgroup$ – David Richerby Dec 28 '17 at 17:19
  • $\begingroup$ Thanks! As a comment that isn't worthy of an edit, I realise that the question as posed is a little convoluted, although I tried to make it as clean as possible. Do feel free to ask for any clarifications. $\endgroup$ – user129412 Dec 28 '17 at 17:23
  • 1
    $\begingroup$ I have a few questions. 1. Are the blue line and red line both guaranteed to go through the origin? 2. Does $S_P$ vary smoothly and monotonically as a function of the angle between the red line and the plane? Does $S_L$ and monotonically as a function of the angle between the red line and the blue line? 3. Do you know what that function is? Do you have an analytical expression for it? Or is it unknown? 4. Can you measure $S_P$ and $S_L$ perfectly, or is there some random noise in the measurement? $\endgroup$ – D.W. Dec 28 '17 at 19:28
  • $\begingroup$ 1. The coordinate system drawn is the coordinate system of the red arrow, in which theta and phi are defined so it goes through that origin. Blue I'm not sure, I would think it does not always, but I don't think that it is essential as red and blue only need to be parallel, not overlap. So we can always shift the coordinate system. 2 and 3. In principle they do, yes. They behave something like the positive branch of a cosine, as it is an angle dependence. They look something like i.imgur.com/ellLafi.png, an actual measurement of S_P. 4. Noise should be irrelevant to a large extent $\endgroup$ – user129412 Dec 28 '17 at 19:57
  • $\begingroup$ For a bit of context of the above, with S_P we are tracking the resonant frequency of a waveguide, which is maximal when the red arrow is in the plane of the waveguide. It is superconducting so it wants the red arrow (magnetic field) to be in its plane, else its resonance frequency will go down and out of our measurement window. So we see a Lorentzian with a center frequency that depends on theta and phi. The blue line also produces such a resonance frequency that we measure with S_L, but this very quickly leaves our measurement window if the red line is not parallel. $\endgroup$ – user129412 Dec 28 '17 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.