spectral analysis for time series data
Show older comments
I am attempting to analyse a time series with spectral analysis and am working through the example shown in:
Here it states:
Compute the power spectral density, a measurement of the energy at various frequencies, using the complex conjugate (CONJ). Form a frequency axis for the first 127 points and use it to plot the result. (The remainder of the points are symmetric.)
Is there any relevance as to why you form a frequency axis for the first 127 points, why 127? and also in the line
f = 1000/251*(0:127);
where does the 1000 come from?
Sorry for what is probably very basic to most matlab users, but my knowledge of data analysis in the frequency domain is minimal.
From this example I am trying to detect any periodicities in my data, which is composed of hourly measurements recorded for one week (24 * 7 = 168 measurements), I aim to show the diurnal component of the temperature variation. So far I have:
clear all
StartDate = '2011-07-01 00:00';
EndDate = '2011-07-07 23:00';
DateTime=datestr(datenum(StartDate,'yyyy-mm-dd HH:MM'):60/(60*24):...
datenum(EndDate,'yyyy-mm-dd HH:MM'),...
'yyyy-mm-dd HH:MM');
DateTime=cellstr(DateTime);
DecDay = datenum(DateTime)-datenum(2011,0,0);
t = 0:25/length(DecDay):(25-0.1488);
x = sin(2*pi*50*t) + sin(2*pi*120*t);
y = x + 2*randn(size(t));
Y = fft(y,length(y));
With regards to the example shown in the link where would I go from here?
Accepted Answer
More Answers (1)
Wayne King
on 28 Jun 2012
One way
plot(F,10*log10(xper));
set(gca,'xtick',[1/20 1/12 1/8 1/6 1/4 1/2]);
H = 1./(get(gca,'xtick'));
set(gca,'xticklabel',{H});
xlabel('Period in Hours');
Categories
Find more on Parametric Spectral Estimation 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!