Mean and Median of Values in a matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to take the mean and median of the mean and median of four columns and then store those values in a separate file to plot the graph later. I have 30,000 rows, with four columns as below: The below is an example of the data points. The first column has a different range of flow rates. I want to take the mean and median of all columns, considering that this average will be based on the set range of 1st column, for example, range 800-900, 900-1000, 1000-11000, and so.
The results will be stored in some other file so that I can make the graph. load.
Data file example below:
Flow Rate Entrance Pressure Exit Pressure Pressure Difference
820 7.52 6.5 1.02
820 7.49 6.55 .94
820 7.51 6.52 0.99
820 7.57 6.58 0.99
820 7.58 6.58 1
819 7.54 6.59 0.95
907 9.27 7.8 1.47
915 9.3 7.78 1.52
918 9.35 7.91 1.44
917 9.46 7.97 1.49
1011 11.2 9.44 1.76
1005 11.38 9.58 1.8
1005 11.32 9.54 1.78
1005 11.39 9.49 1.9
1005 11.32 9.51 1.81
1005 11.26 9.44 1.82
Any help is appreciated.
Thanks
댓글 수: 3
Dyuman Joshi
2022년 5월 14일
I'm assuming you want to do seperate matrices for mean and median values? And that you want to use for loops as well?
답변 (3개)
Dyuman Joshi
2022년 5월 14일
I am giving you an example for one variable.
meanvalue=[];
medianvalue=[];
for i=800:100:lastvalue
y=flowrate(flowrate>=i&flowrate<(i+100));
meanvalue=[meanvalue mean(y)];
medianvalue=[medianvalue median(y)];
end
Are the groups in the same range here? i.e 800-900 group in flowrate corresponds to 7-8 group in extrance pressure, 6-7 in exit pressure and 0.9-1 in pressure difference, for all ranges?
If they are not, the output matrix you want (with 4 columns) will not be possible.
댓글 수: 5
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!