analyse specific frequencies in a time series

3 visualizaciones (últimos 30 días)
Richard
Richard el 9 de Ag. de 2012
Comentada: Tsekoa Maqhanolle el 24 de Mzo. de 2017
I have a long data set of water temperature:
t = 1/24:1/24:365;
y = 1 + (30-1).*rand(1,length(t));
plot(t,y)
The series extends for one year and the number of measurements per day is 24 (i.e. hourly). I expect the water temperature to follow a diurnal pattern (i.e. have a period of 24 hours), therefore I would like to evaluate how the 24 hour cycle varies throughout the year. Is there a method for only looking at specific frequencies when analyzing a signal? If so, I would like to draw a plot showing how the 24 hour periodicity in the data varies through the year (showing for example if it is greater in the summer and less in the winter). How could I do this?

Respuesta aceptada

Star Strider
Star Strider el 9 de Ag. de 2012
Editada: Star Strider el 10 de Ag. de 2012
There are probably other ways, but this is how I'd do it:
t = [1/24:1/24:365]'; % Define Time
% GENERATE DATA
y = 1 + (30-1).*rand(1,length(t));
ya = 10 + 20*sin(2*pi*t/max(t)); % Annual variation °C
yd = (1.1 + sin(2*pi*t/max(t))) .* (2*sin(2*pi*t + 4)); % Circadian variation °C
y = ya + yd; % Water Temperature °C
% PLOT ANNUAL TEMPERATURE DATA
figure(1)
plot(t,y)
title('Annual Temperatures')
xlabel('Time (Days)')
ylabel('H_{2}O Temperature (°C)')
grid
% GENERATE ENSEMBLE MATRIX OF DAILY TEMPERATURE RECORDS BY HOUR
for k1 = 1:365
DayT(:,k1) = y([1:24]+24*(k1-1));
end
% FIND TEMPERATURE MAXIMA AND MINIMA AND THE TIMES THEY OCCUR FOR EACH DAY
for k1 = 1:365
[TempMax TimeMax] = max(DayT(:,k1));
DayMax(k1,:) = [TempMax TimeMax];
[TempMin TimeMin] = min(DayT(:,k1));
DayMin(k1,:) = [TempMin TimeMin];
end
% PLOT SELECTED DAILY TEMPERATURES
figure(2)
plot([1:24]', DayT(:,1:19:end))
title('Daily Temperatures')
xlabel('Time (Hours)')
ylabel('H_{2}O Temperature (°C)')
grid
The variable DayT is your [24 x 365] matrix of hourly temperature data by day. [In the figure(2) plot, I limited the display to provide clarity.]
NOTE that I created all data as column vectors or column-major matrices for convenience.
For techniques to analyse your data, I suggest you explore DETECTING TREND AND OTHER CHANGES IN HYDROLOGICAL DATA. Hydrology and climatology aren't my areas of expertise, so I can't advise you further.
  3 comentarios
Star Strider
Star Strider el 10 de Ag. de 2012
My pleasure!
Tsekoa Maqhanolle
Tsekoa Maqhanolle el 24 de Mzo. de 2017
What if the data is for every 30 minutes and i wand to calculate the mean of values of the 30 min mark for the whole year, then the 1-hour mark mean for the hole year, 1:30hr mark for the same period until i reach to the 24hr mark? The data is in excel format

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by