78d04f1seqlab: write and view pulseq MRI sequences in the browserJeremy Magland 1function xf=findFlank(x,f,c)
2%findFlank: find the x coordinate of the left flank of function f
3% Finds the furst value within x for which abs(f) is greater than
4% c*max(abs(f)). If xf is not the first element of x, then a linear
5% interpolation is applied.
6m=max(abs(f));
7f=abs(f)/m-c;
8i=find(f>0,1);
9if i>1
10 f0=f(i-1);
11 f1=f(i);
12 xf=(f1*x(i-1)-f0*x(i))/(f1-f0);
13else
14 xf=x(1);
15end
17end