SCM

SCM Repository

[batman] Annotation of /SplineFitBATMAN_MATLABcode/intersectSpecSplineRatio.m
ViewVC logotype

Annotation of /SplineFitBATMAN_MATLABcode/intersectSpecSplineRatio.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 346 - (view) (download)

1 : jie 346 function ppmx = intersectSpecSplineRatio(Xn, offset, x, y, ppm)
2 :     % written 120213 Dr. Jie Hao, Imperial College London
3 :     % modified 21/05/2013
4 :     [n,m]=size(Xn);
5 :     offy=[0:n-1].*offset;
6 :     off = repmat(offy',1,m);
7 :     D = Xn + off;
8 :     [y iy]=sort(y);
9 :     x=x(iy);
10 :     t = 1:length(x);
11 :     xy = [x,y];
12 :    
13 :     ppmx = zeros(2,size(D,1));
14 :    
15 :     for i = 1:length(x)
16 :     [~, xid]= min(abs(ppm-x(i)));
17 :     [~, yid(i,1)] = min(abs(D(:,xid) - y(i)));
18 :     if (i == 1 || i == length(x))
19 :     [~,fl] = min(abs(D([1,end],xid)-y(i)));
20 :     if (fl == 1)
21 :     yid(i,1) = 1;
22 :     else
23 :     yid(i,1) = size(D,1);
24 :     end
25 :     end
26 :     end
27 :    
28 :     ts = [];
29 :     for i = 1:length(x)-1
30 :     tmp = i:1/(yid(i+1)-yid(i)):i+1;
31 :     ts = [ts, tmp];
32 :     end
33 :     ts = unique(ts);
34 :     ppmx = spline(t,xy',ts);

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge