How to find average of two lines on a graph

2 views (last 30 days)
Ross Hanna
Ross Hanna on 11 Aug 2017
Answered: Chad Greene on 12 Aug 2017
Hi there.
I am doing some research into computing suspension characteristics of motorcycle suspension. We have used a suspension dynamometer (damper dyno) to record time, force, displacement and velocity. The damper dyno gives data in the form of a text file as attached below (Damper Dyno CR500 Shock.txt). I have copied this into excel and converted all the data into numbers that can be manipulated. I have plotted force vs displacement, force vs velocity and absolute force vs velocity. I have attached the excel file ( below so you can see what i'm talking about in this next bit. the force vs velocity graph loops back on itself and to get a useful graph you have to take the average of the two lines e.g at 200 m/s the force in the positive region is 300N and 600N. I need the average force so in that example 450N but for all the 4984 data points. I am on matlab answers because i think you will be able to help make it simpler using matlab rather than overtaxing matlab with a 5000x5000 table.
So my question is... for the graph on the sheet labelled 'F vs V (abs F), can you think of a way to average the data to give a graph like the picture i have added (Average Force vs Velocity.jpg) which is the same data just an average of the force to give a single line rather than the loop.
Many thanks
Ross
  1 Comment
Ross Hanna
Ross Hanna on 12 Aug 2017
ok, second question which may simplify my reasoning for what i want to do.
x=Force %imported from excel as column vector y=Velocity %imported from excel as column vector plot(x,y)
now, i'm trying to average force, so, how could i write a code that if i give it a velocity of 400m/s, gives me the however many answers there is (say two for ease). this code partially does it but returns only one result.
%example X=Force; Y=Velocity; index=find(Y==400); X_point=X(index)
if this gave me the two results, i could then average them, repeat every however many times to do it for the whole graph. however, i would need to do the positive y values first, then the negative and average separately.
Thanks

Sign in to comment.

Answers (1)

Chad Greene
Chad Greene on 12 Aug 2017
Looks like a classic hysteresis loop. You could sort the data and take a moving average, or fit a curve, or use my scatstat1 function.

Categories

Find more on 2-D and 3-D Plots 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!