Calling out data that loops back around

1 view (last 30 days)
John
John on 11 Jun 2014
Answered: Sean de Wolski on 11 Jun 2014
I imported an excel file and this is what it looks like: My code slopes up, reaches a peak, and then loops back under with the same x values but different y values. I don't know how to call out just the unloading or loop part of the curve. That is the only part of the data that I need to analyze. to visualize, the whole curve looks like shark tooth.
Then, I have a second set that does the same thing but repeats 5 times each time passing almost through the same points initially before passing them. Kind of looks like serrated teeth of increasing size right up against each other. But these ones almost share some of the same points and so I can't just call out the max and min value because there are multiple.
Thoughts? Help please.

Answers (1)

Sean de Wolski
Sean de Wolski on 11 Jun 2014
Find the index of the maximum x value and keep everything from then on out:
x = [1:10 10:-1:1];
y = flip(cumsum(x));
[~,idx] = max(x);
xlow = x(idx:end);
ylow = y(idx:end);
plot(x,y)
hold on
plot(xlow,ylow,'r*')

Categories

Find more on Curve Fitting Toolbox 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!