finding the intersection for a trace to a threshold
Show older comments
Hi I am trying to find the points of intersection of a trace compared to a threshold. Let me explain, I have the trace of the movement of the foot in the z axis (raising the toe and putting it back to the floor in a step) and I want to find the points of intersection of a determined threshold (which is 5 mm above the minimum point of the swing of the toe). I have tried codes that I have found around but I need something according to my data
zstp=Rtoez(mRTO(i):mRHS(i));
t1M=find(islocalmax(nzstp,'MaxNumExtrema',1));
tmin=find(islocalmin(nzstp(t1M:end)))+t1M-1;
tclear=zstp(tmin);ntclear=nzstp(tmin);
traise=nzstp(t1M);
%% Determining the initial threshold
cutoff=round(ntclear+5)*ones(size(nzstp,1),1);
if cutoff > (ntclear+5)
cutoff=cutoff-1;
end
So now I need the intersects of nzstp to cutoff, so I can calculate the area under the threshold but above the curve
Accepted Answer
More Answers (1)
Turlough Hughes
on 4 Oct 2019
I'm not sure which variable you use to represent your x data, but lets call it x, where x is the same size as nzstp and cutoff.
[xi, yi]=polyxpoly(x,nzstp, [x(1) x(end)],[cutoff(1) cutoff(end)]);
hold on; plot(xi,yi,'^k')
The inputs are your curve data and the start and end points for your threshold line which I have written as
x,nzstp % curve data
[x(1) x(end)],[cutoff(1) cutoff(end)] %start and end point of threshold line
Note you may need to download the mapping toolbox if you dont already have it installed in order to you polyxpoly.
2 Comments
darova
on 4 Oct 2019
I love polyxpoly
darova
on 4 Oct 2019
Intersections do the same also
Categories
Find more on Computational Geometry in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
