MATLAB Answers

how to plot the mean of values from swept data

4 ビュー (過去 30 日間)
Em 2020 年 11 月 17 日
コメント済み: Em 2021 年 1 月 18 日
Hi everyone,
I have a array of data where I ramped one variable and measured another a number of times. I would like to find the average of the independent variable at each data point in order to plot this. Does anyone have any suggestions on how I could do this?

  0 件のコメント



Cris LaPierre
Cris LaPierre 2020 年 11 月 17 日
Sure. Use groupsummary. Your grouping variable is your dependent variable, your method is 'mean', and your datavar is your independent variable.
Take the results and plot.

  11 件のコメント

表示 8 件の古いコメント
Em 2021 年 1 月 17 日
Thank you.
So I have tried both
G = groupsummary(acetone,[1,2],'mean')
statarray = grpstats(acetone,[1,2],'mean')
To get this data I've changed the variable in column 1 and recorded column 2 a number of times. I want to find the average column 2 value between each time I applied the column 1 variable.
With G and statarray, there are several column 1 values repeated - so it goes between -20 and 20, and there are a few dozen of each column 1 value, really I just want one average value for each column 1 value.
But also below 4 there are no column 1 values at all. I'm not sure what could be happening here.
Thank you for your help with this and sorry if I'm just not understanding something simple.
Cris LaPierre
Cris LaPierre 2021 年 1 月 18 日
Ok, values in the first column of G are duplicated because the grouping is by e07 then VarName1. It is the unique combinations of these 2 variables that creates a group. For example
e07 VarName1
_________ ________
-9.17e-07 -19.4
-9.17e-07 -14.2
It sounds like perhaps you just want to group by VarName1? The just do
G = groupsummary(acetone,"VarName1","mean")
Em 2021 年 1 月 18 日
This is exactly what I was looking for, thank you!


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by