Find average average value of data

1 view (last 30 days)
Hello,
I have this code, I want it to do a single run, in a way that it the code exucte the value for each row independently.
clear
x=[
-81.12 -78.91 -73.64 -79.26 -155.66
% -81.19 -79.08 -79.17 -86.1 -155.69
% -79.76 -79.29 -79.18 -85.93 -155.66
% -79.81 -79.36 -78.9 -85.69 -155.7
% -80.06 -79.38 -78.35 -86.08 -149.37
% -79.84 -79.39 -79.32 -86.26 -149.39
% -80.76 -79.37 -79.39 -86.59 -149.33
% -80.82 -79.35 -79.6 -86.62 -149.21
% -79.85 -79.38 -79.15 -86.7 -148.51
% -79.94 -79.35 -79.14 -87.54 -148.38
% -85.64 -79.39 -79.28 -87.38 -149.05
% -85.28 -79.37 -79.25 -87.36 -157.36
% -85.07 -79.31 -79.12 -87.32 -157.9
% -84.82 -79.32 -78.14 -87.08 -157.64
% -84.63 -79.32 -78.66 -87.01 -157.77
% -84.65 -79.38 -78.62 -87.06 -157.89
% -84.5 -79.4 -78.61 -86.41 -157.84
% -84.52 -79.49 -78.65 -86.45 -157.18
% -84.44 -79.56 -78.74 -86.39 -157.24
% -84.46 -79.35 -78.86 -86.59 -157.38
% -84.45 -79.49 -78.4 -86.69 -154.74
% -84.5 -79.49 -79.38 -86.71 -155.95
% -84.69 -84.67 -79.08 -87.02 -156.12
% -84.75 -84.46 -79.52 -87.12 -156.19
% -84.82 -83.75 -79.52 -87.43 -156.43
% -84.89 -83.78 -79.61 -87.61 -156.22
% -85.2 -83.93 -103.65 -106.35 -156.39
% -85.23 -83.93 -103.78 -106.49 -155.31
% -85.45 -84 -106.8 -134.02 -156.11
% -85.65 -84.06 -106.76 -134.03 -156.2
% -85.29 -84.07 -106.73 -134.02 -156.28
% -85.52 -84.13 -149.52 -134.64 -156.3
% -85.41 -84.05 -150.07 -134.84 -118.03
% -85.33 -83.97 -150.61 -133.6 -115.95
% -85.41 -84.1 -151.85 -133.58 -120.51
% -84.94 -83.24 -152.24 -133.71 -120.52
% -84.24 -84.24 -152.28 -133.67 -114.39
% -84.85 -84.19 -152.17 -133.7 -104.43
% -84.87 -83.2 -152.49 -133.63 -104.4
% -84.85 -84.02 -152.57 -133.54 -105.27
% -85.05 -83.98 -152.88 -133.44 -105.98
% -84.94 -83.92 -131.47 -131.92 -106.36
% -83.66 -83.95 -131.34 -132.6 -107.98
% -84.47 -83.87 -132.56 -132.56 -108.02
% -84.49 -114.44 -124.85 -129.22 -112.34
% -84.8 -114.85 -124.7 -127.46 -117.68
% -84.9 -114.94 -123.91 -127.12 -125.7
% -84.03 -128.46 -124.04 -126.78 -125.14
% -83.89 -128.54 -124.33 -127.01 -116.16
% -83.4 -128.47 -124.55 -127.11 -116.17
% -83.5 -128.47 -124.97 -127.18 -116.99
% -83.49 -128.51 -125.3 -126.54 -117.9
% -83.8 -128.43 -125.03 -127.11 -117.82
% -83.67 -128.74 -124.9 -127.06 -151.93
% -83.3 -128.79 -124.69 -127.36 -151.98
];
xx=x/10;
X=10.^xx;
RSS=10*log10(mean(X))

Accepted Answer

Star Strider
Star Strider on 21 Sep 2024
Edited: Star Strider on 21 Sep 2024
To get the mean of each row, calculate the mean across dimension 2 (column size) —
x=[ -81.12 -78.91 -73.64 -79.26 -155.66
-81.19 -79.08 -79.17 -86.1 -155.69
-79.76 -79.29 -79.18 -85.93 -155.66
-79.81 -79.36 -78.9 -85.69 -155.7
-80.06 -79.38 -78.35 -86.08 -149.37
-79.84 -79.39 -79.32 -86.26 -149.39
-80.76 -79.37 -79.39 -86.59 -149.33
-80.82 -79.35 -79.6 -86.62 -149.21
-79.85 -79.38 -79.15 -86.7 -148.51
-79.94 -79.35 -79.14 -87.54 -148.38
-85.64 -79.39 -79.28 -87.38 -149.05
-85.28 -79.37 -79.25 -87.36 -157.36
-85.07 -79.31 -79.12 -87.32 -157.9
-84.82 -79.32 -78.14 -87.08 -157.64
-84.63 -79.32 -78.66 -87.01 -157.77
-84.65 -79.38 -78.62 -87.06 -157.89
-84.5 -79.4 -78.61 -86.41 -157.84
-84.52 -79.49 -78.65 -86.45 -157.18
-84.44 -79.56 -78.74 -86.39 -157.24
-84.46 -79.35 -78.86 -86.59 -157.38
-84.45 -79.49 -78.4 -86.69 -154.74
-84.5 -79.49 -79.38 -86.71 -155.95
-84.69 -84.67 -79.08 -87.02 -156.12
-84.75 -84.46 -79.52 -87.12 -156.19
-84.82 -83.75 -79.52 -87.43 -156.43
-84.89 -83.78 -79.61 -87.61 -156.22
-85.2 -83.93 -103.65 -106.35 -156.39
-85.23 -83.93 -103.78 -106.49 -155.31
-85.45 -84 -106.8 -134.02 -156.11
-85.65 -84.06 -106.76 -134.03 -156.2
-85.29 -84.07 -106.73 -134.02 -156.28
-85.52 -84.13 -149.52 -134.64 -156.3
-85.41 -84.05 -150.07 -134.84 -118.03
-85.33 -83.97 -150.61 -133.6 -115.95
-85.41 -84.1 -151.85 -133.58 -120.51
-84.94 -83.24 -152.24 -133.71 -120.52
-84.24 -84.24 -152.28 -133.67 -114.39
-84.85 -84.19 -152.17 -133.7 -104.43
-84.87 -83.2 -152.49 -133.63 -104.4
-84.85 -84.02 -152.57 -133.54 -105.27
-85.05 -83.98 -152.88 -133.44 -105.98
-84.94 -83.92 -131.47 -131.92 -106.36
-83.66 -83.95 -131.34 -132.6 -107.98
-84.47 -83.87 -132.56 -132.56 -108.02
-84.49 -114.44 -124.85 -129.22 -112.34
-84.8 -114.85 -124.7 -127.46 -117.68
-84.9 -114.94 -123.91 -127.12 -125.7
-84.03 -128.46 -124.04 -126.78 -125.14
-83.89 -128.54 -124.33 -127.01 -116.16
-83.4 -128.47 -124.55 -127.11 -116.17
-83.5 -128.47 -124.97 -127.18 -116.99
-83.49 -128.51 -125.3 -126.54 -117.9
-83.8 -128.43 -125.03 -127.11 -117.82
-83.67 -128.74 -124.9 -127.06 -151.93
-83.3 -128.79 -124.69 -127.36 -151.98];
xx=x/10;
X=10.^xx;
RSS=10*log10(mean(X,2));
RSS_size = size(RSS)
RSS_size = 1×2
55 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
disp(RSS)
-78.1994 -81.6086 -81.3106 -81.2361 -81.1368 -81.4334 -81.7190 -81.7998 -81.4043 -81.4624 -82.5386 -82.4799 -82.3757 -81.8982 -82.1122 -82.1225 -82.0639 -82.1200 -82.1716 -82.1624 -82.0159 -82.4471 -83.7358 -83.9707 -83.8745 -83.9567 -88.4576 -88.4715 -88.6309 -88.7483 -88.6033 -88.7490 -88.6554 -88.5748 -88.6846 -87.9862 -88.2173 -88.4648 -87.9150 -88.3768 -88.4461 -88.3656 -87.7736 -88.1301 -91.4677 -91.7825 -91.8842 -91.0185 -90.8764 -90.3868 -90.4871 -90.4775 -90.7873 -90.6590 -90.2891
The default behaviour is to calculate the mean or each column (equivalent to mean(X,1)).
.
EDIT — Corrected typographical errors.
.

More Answers (0)

Categories

Find more on Electrical Block Libraries 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!