All you need is to detect which of the vx,vy
crosses the axes (using find
or logical conditions, find(vx<0)
, find(vy>1)
etc...) , and then apply the equation of the line y=a*x+b
. For the point you wanted (which happens to be the 19th col of vx,vy
, the slope a
is:
a=diff(vy(:,19))/diff(vx(:,19));
and the intersection with y axis is given by b
:
b=vy(1,19)-a*vx(1,19)
b =
0.7546
To calc b
I picked the first point [vx(1,19),vy(1,19)]
but this of course works also for the second point, i.e. b=vy(2,19)-a*vx(2,19)