how to take mean of three dimension data at seasonal scale?

1 visualizzazione (ultimi 30 giorni)
Hello everyone,
I have temperature data in matrix (180X360X120). 180X360 respresents latitude and longitude, and 120 represents temperarture in 10 years (120months). I want to take mean of temperature at seasonal scale (MAM, JJA & SON).
Final output should be MAM = 180X360X30; JJA = 180X360X30; SON = 180X360X30
% I have tried the same with vector data
mam = sort([[3:12:120],[4:12:120],[5:12:120]]);
x = reshape(mam,3,numel(mam)/3);
MAM =(data(:,x));
y = reshape(MAM,3,numel(MAM)/3);
temp_MAM = mean(y);
How can I do the same with matrix data?
Thanks

Risposta accettata

Walter Roberson
Walter Roberson il 4 Ago 2022
Same basic way,
mam = reshape([3:12:120; 4:12:120; 5:12:120], 1, []);
MAM = data(:,:,mam);
MAM3 = reshape(MAM, size(data,1), size(data,2), 3, []);
MAM3mean = reshape(mean(MAM3, 3), size(data,1), size(data,2), []);
  2 Commenti
Aarti Soni
Aarti Soni il 5 Lug 2023
Modificato: Aarti Soni il 5 Lug 2023
Similarly, I have 15days temperature data for 10 years means every month is having two files and data is in three dimension format (i.e., 180 X 360 X 240). I want to take mean of every two files to make it monthly mean (180 X 360 X 120).
How can I do this with reshape function or is there any other way to solve this?
I always appreciate for your help.
Thanks in advance.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Cell Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by