How to find average of two lines on a graph

조회 수: 2 (최근 30일)
Ross Hanna
Ross Hanna 2017년 8월 11일
답변: Chad Greene 2017년 8월 12일
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
Ross Hanna
Ross Hanna 2017년 8월 12일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Chad Greene
Chad Greene 2017년 8월 12일
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.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by