Average of 5 locations for each time

1 vue (au cours des 30 derniers jours)
FIONA HOTCHKISS
FIONA HOTCHKISS le 9 Déc 2021
Commenté : Star Strider le 9 Déc 2021
%Point Barrow, Alaska
PB=readtable('monthly_flask_co2_ptb.csv');
%create time and CO2 variable
%time
PBdailyt=PB(:,4);
%CO2
PBdailyCO2=PB(:,7);
%take data out of table and put into array
PBt=table2array(PBdailyt);
PBCO2=table2array(PBdailyCO2);
%index to extract outliers
idx = PBCO2 >=500 | PBCO2 <=300 ;
%set outliers equal to NaN
PBCO2(idx) = NaN;
I have 5 different locations, above I have included one of them. I am trying to calcuate the average of all 5 locations to plot against time. My goal is to have the 5 locations combined and plotted against time, and then to extrapolate it.
  2 commentaires
Image Analyst
Image Analyst le 9 Déc 2021
You forgot to attach 'monthly_flask_co2_ptb.csv'.
FIONA HOTCHKISS
FIONA HOTCHKISS le 9 Déc 2021
I=imread('monthly_flask_co2_ptb')
imshow(I)

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 9 Déc 2021
This is all a bit arcane. See if the movmean function will produce the desired result.
.
  1 commentaire
Star Strider
Star Strider le 9 Déc 2021
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/828030/monthly_flask_co2_ptb.csv', 'VariableNamingRule','preserve', 'HeaderLines',56)
T1 = 552×10 table
Var1 Var2 Excel Var4 [ppm] [ppm]_1 [ppm]_2 [ppm]_3 [ppm]_4 [ppm]_5 ____ ____ _____ ______ ______ _______ _______ _______ _______ _______ 1974 1 27044 1974 336.15 332.46 336.24 332.54 336.15 332.46 1974 2 27075 1974.1 -99.99 -99.99 336.8 332.57 336.8 332.57 1974 3 27103 1974.2 337.16 332.71 337.05 332.6 337.16 332.71 1974 4 27134 1974.3 336.37 332.05 336.95 332.63 336.37 332.05 1974 5 27164 1974.4 336.99 332.35 337.31 332.66 336.99 332.35 1974 6 27195 1974.5 336.42 334.01 335.01 332.69 336.42 334.01 1974 7 27225 1974.5 330.8 335.4 327.99 332.72 330.8 335.4 1974 8 27256 1974.6 323.1 333.02 322.8 332.74 323.1 333.02 1974 9 27287 1974.7 323.96 331.96 324.84 332.77 323.96 331.96 1974 10 27317 1974.8 327.82 331.36 329.33 332.8 327.82 331.36 1974 11 27348 1974.9 332.55 332.45 332.99 332.84 332.55 332.45 1974 12 27378 1975 335.14 332.56 335.49 332.88 335.14 332.56 1975 1 27409 1975 337.14 333.43 336.65 332.92 337.14 333.43 1975 2 27440 1975.1 338.72 334.47 337.23 332.97 338.72 334.47 1975 3 27468 1975.2 336.62 332.13 337.5 333.02 336.62 332.13 1975 4 27499 1975.3 337.34 332.99 337.42 333.07 337.34 332.99
DTV = table(datetime(T1{:,1},T1{:,2},ones(size(T1{:,1}))), 'VariableNames',{'Date'});
T2 = [DTV, T1(:,5:end)]
T2 = 552×7 table
Date [ppm] [ppm]_1 [ppm]_2 [ppm]_3 [ppm]_4 [ppm]_5 ___________ ______ _______ _______ _______ _______ _______ 01-Jan-1974 336.15 332.46 336.24 332.54 336.15 332.46 01-Feb-1974 -99.99 -99.99 336.8 332.57 336.8 332.57 01-Mar-1974 337.16 332.71 337.05 332.6 337.16 332.71 01-Apr-1974 336.37 332.05 336.95 332.63 336.37 332.05 01-May-1974 336.99 332.35 337.31 332.66 336.99 332.35 01-Jun-1974 336.42 334.01 335.01 332.69 336.42 334.01 01-Jul-1974 330.8 335.4 327.99 332.72 330.8 335.4 01-Aug-1974 323.1 333.02 322.8 332.74 323.1 333.02 01-Sep-1974 323.96 331.96 324.84 332.77 323.96 331.96 01-Oct-1974 327.82 331.36 329.33 332.8 327.82 331.36 01-Nov-1974 332.55 332.45 332.99 332.84 332.55 332.45 01-Dec-1974 335.14 332.56 335.49 332.88 335.14 332.56 01-Jan-1975 337.14 333.43 336.65 332.92 337.14 333.43 01-Feb-1975 338.72 334.47 337.23 332.97 338.72 334.47 01-Mar-1975 336.62 332.13 337.5 333.02 336.62 332.13 01-Apr-1975 337.34 332.99 337.42 333.07 337.34 332.99
T2.('Site Monthly Mean') = mean(T2{:,2:end},2)
T2 = 552×8 table
Date [ppm] [ppm]_1 [ppm]_2 [ppm]_3 [ppm]_4 [ppm]_5 Site Monthly Mean ___________ ______ _______ _______ _______ _______ _______ _________________ 01-Jan-1974 336.15 332.46 336.24 332.54 336.15 332.46 334.33 01-Feb-1974 -99.99 -99.99 336.8 332.57 336.8 332.57 189.79 01-Mar-1974 337.16 332.71 337.05 332.6 337.16 332.71 334.9 01-Apr-1974 336.37 332.05 336.95 332.63 336.37 332.05 334.4 01-May-1974 336.99 332.35 337.31 332.66 336.99 332.35 334.78 01-Jun-1974 336.42 334.01 335.01 332.69 336.42 334.01 334.76 01-Jul-1974 330.8 335.4 327.99 332.72 330.8 335.4 332.19 01-Aug-1974 323.1 333.02 322.8 332.74 323.1 333.02 327.96 01-Sep-1974 323.96 331.96 324.84 332.77 323.96 331.96 328.24 01-Oct-1974 327.82 331.36 329.33 332.8 327.82 331.36 330.08 01-Nov-1974 332.55 332.45 332.99 332.84 332.55 332.45 332.64 01-Dec-1974 335.14 332.56 335.49 332.88 335.14 332.56 333.96 01-Jan-1975 337.14 333.43 336.65 332.92 337.14 333.43 335.12 01-Feb-1975 338.72 334.47 337.23 332.97 338.72 334.47 336.1 01-Mar-1975 336.62 332.13 337.5 333.02 336.62 332.13 334.67 01-Apr-1975 337.34 332.99 337.42 333.07 337.34 332.99 335.19
Please be specific about what the desired result is, if this is not the desired result.
.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Preprocessing dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by