Eric Carlson <ecarlson@coe.eng.ua.edu> wrote in message <ioOwh.33$FX6.13@newsfe02.lga>...
> JFG wrote:
> > Hi, I have two parametric curves defined in three dimensions, which are functions of a variable t, like so:
> >
> > x1 = f1(t)
> > y1 = f2(t)
> > z1 = f3(t)
> >
> > x2 = f4(t)
> > y2 = f5(t)
> > z2 = f6(t)
> >
> > I am trying to find the intersection of these two curves, but I am having some difficulty with the mathematics. In two dimensions, I simply solve for t as a function of x, and then plug that value of t into my y function to obtain y as a function of x. With three dimensions, I cannot do this.
> >
> > Any idea of how I should approach this problem? Thanks!
> %x1,x2..already defined as functions
> guess = whatever;
> dist=@(t) norm( x2(t)x1(t), y2(t)y1(t),z2(t)z1(t));
> fminsearch(dist, guess)
>
> I'll let you at least figure out how to tell if they intersect 
> hope it's not homework.
>
> Cheers,
> Eric Carlson
Hmm I to having similar problem.
First I changed the usage of norm so that it read:
dist = @(t) norm( [x2(t)x1(t) y2(t)y1(t) z2(t)z1(t)] )
ie square bracket and no comma, as it was only way I could get it to give me without error, is this already an incorrect step?
THen when I try fminsearch and substitute a starting seed value for 'guess', I end up with a value which I assume to be the value for 't' where the norm function gave me a minimum, ie the 't' value for the point of intersection, is this again an incorrect statement??
As when I plug this t value I get different coordinates for when I substitue into the first set of parametric equations than with the second, a little confused with how this is working?...
