SCM

SCM Repository

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

View of /SplineFitBATMAN_MATLABcode/intersectSpecSplineRatio.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 346 - (download) (annotate)
Tue Nov 11 03:01:17 2014 UTC (3 years, 1 month ago) by jie
File size: 736 byte(s)
matlab
function ppmx = intersectSpecSplineRatio(Xn, offset, x, y, ppm)
% written 120213 Dr. Jie Hao, Imperial College London
% modified 21/05/2013
[n,m]=size(Xn);
offy=[0:n-1].*offset;
off = repmat(offy',1,m);
D = Xn + off;
[y iy]=sort(y);
x=x(iy);
t = 1:length(x);
xy = [x,y];

ppmx = zeros(2,size(D,1));

for i = 1:length(x)
    [~, xid]= min(abs(ppm-x(i)));
    [~, yid(i,1)] = min(abs(D(:,xid) - y(i)));
    if (i == 1 || i == length(x))
        [~,fl] = min(abs(D([1,end],xid)-y(i)));
        if (fl == 1)
            yid(i,1) = 1;
        else
            yid(i,1) = size(D,1);
        end
    end
end

ts = [];
for i = 1:length(x)-1
    tmp = i:1/(yid(i+1)-yid(i)):i+1;
    ts = [ts, tmp];
end
ts = unique(ts);
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