How can I get the mean data from under the graphs?
Show older comments
Hi,
I am struggeling with getting the mean values from my data. 

When plotted my data looks like this (this is only a small sample of the whole thing). I want to get the mean values of the signal from everything above 0. But not the noise you see around the 0 yline, the data is already filtered at the frequency it needs to be. I have tried it with manually looking up the range of the data which I needed and then:
data = [all_data(39:111) all_data(150:171)]
meandata = mean(data(data>0))
But this would take me years to manually look up every data point I need. I thought maybe a loop could help by telling MATLAB if the value is >0 for a period of 10 or more sample then sum/mean but I can't figure out how to do this?
Hope anyone can help me, thanks in advance!
Accepted Answer
More Answers (1)
Jonas
on 30 Jun 2022
what about a general threshold like 10 here?
mean(all_data(all_data>10))
2 Comments
Carmen Brouwers
on 30 Jun 2022
Jonas
on 30 Jun 2022
but you wrote you want to ignore the noise around the 0 value?
Categories
Find more on Descriptive Statistics 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!
