Finding max force values in macro with 100 cycles, in a specific interval

3 views (last 30 days)
I have a actuator that moves from postition 0 to postion 5000 and back to postion 0 again, this cycle is repeated 100 times
i want to find the Max Force value for each cycle in a specific position interval.
Here is my code, i'm a noob at matlab:
filename='Cycle 0-100test.csv';
data = dlmread(filename);
Force = data(109:end,2);
Position =data(109:end,4);
d = [1;diff(Position)];
Position(d<0) = -Position(d<0);
1interval=find(Position>3000 & Position<4400);
2interval=find(Position>-5000 & Position<-3000);
Firstpeak=max(Force(1interval));
Firstpeak2=min(Force(2interval));
I know i have to make some sort of loop. But i cant figure out how to do it :/
  5 Comments
Morten Nielsen
Morten Nielsen on 28 Jun 2019
Yes, i know islocalmax, but im only interested in finding these peaks (marked with a circle)
I need to find them for each cycle (100 cycles) and their respective index number
sorry I have only been using matlab for a couple of days.
peaks.png
dpb
dpb on 28 Jun 2019
I'd do something like compute the overall mean and then find exceedance of it by a variable factor; the magnitude of the factor being determined empirically to return only peaks of some preset distance apart. If the sample waveform is representative, this should be reasonably robust with the possible exception of eliminating the overshoot recovery peak that looks like can get to be reasonably close to the desired pre-peak of interest.
The undershoot peak looks to be quite simple to isolate that way on the negative side as it is quite sizable and noise free.
You can't get access to the Signal Processing Toolbox? Is a real hamstring if going to be doing much signal processing...

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!