Unclear periodicity output with daily temperature dataset using periodogram
Show older comments
Dear all, I am struggling to find a meaningful periodicity of my dataset. Your help would be much appreciated.
I have a dataset (Temp) containing 10 years of temperatures above background. The sampling frequency is one datapoint per day.
Considering that Temp contains the delta T above background, most of the seasonality is smoothened, altought still visible.
As I have several datasets to analyse (where the periodicity might vary), I need to find a way to establish the periodicity of a given dataset.
I tried running the code below (based on https://it.mathworks.com/help/signal/ug/find-periodicity-using-frequency-analysis.html), but I get an unexpected and unclear result.
Time= %MyDailyTempData; 4032x1 double
Temp= %MyDailyTimeData; 4032x1 datetime
fs = 1; % Sampling frequency (1 acquisition per day)
t = (0:length(Temp) - 1)/fs; % Time vector
tempnorm = Temp - mean(Temp); % Subtract the mean to concentrate on temperature fluctuations (based on the link above)
[pxx,f] = periodogram(tempnorm,[],[],fs);
% To find the peak (periodicity of my data)
j=max(pxx);
jj=find(pxx==j);
P=f(jj);
% Plot
figure
subplot(2,1,1)
plot(Time,Temp)
title('Temperature - Mean')
xlabel('Time (Years)')
ylabel('Delta Temperature ( {}^\circC )')
axis tight
subplot(2,1,2)
plot(f,pxx)
grid
title('Periodicity',P)
xlabel('Frequency')
ylabel('Magnitude')
From the above, I obtain:

Now, I would expect my data to have a periodicity of 1 year (by looking at the graph). Additionally, I don't get what 0.1875 represents.
Could you please help me to figure out what I am doing wrong and how to fix it to obtain meaningful results? Ideally, I would like to obtain a bottom graph with the scale in months, or in years. With the pick (in this occasion) heaving a meaningful value of 12 (if months), or 1 (if years).
Thanks in advance for your help!
Accepted Answer
More Answers (1)
Image Analyst
on 4 Feb 2023
0 votes
I agree with everything Star said - I was going to say the same things. But what is "background"? Does that change seasonally? If so, maybe "delta T" is fairly constant seasonally????
I don't really have suggestions for what a 5 day periodicity in the data might mean. Now 7 days I could possibly see because that coincides with typical work weeks and the temperature may vary periodically weekly as people stay home for the weekend.
Categories
Find more on Programming 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!

