frequency domain linear regression
조회 수: 1 (최근 30일)
이전 댓글 표시
First, is about frequency bin termin. In this tutorial we have frequency bin for positive and negative frequency, and it can be calculated like lengths of time series / period of time series + 1, for positive frequencies. For negative frequencies frequency bin is length of time series - lengths of time series / period of time series + 1. In my example, length of time series is odd number and I need to use it later like index in other time series, but than I have decimal number. I am not sure, what to do and is this principle of calculating frequency bins ok?
%
freqbin = 72/12;
freqbins = [freqbin 72-freqbin]+1;
tsfit = zeros(72,1);
tsfit(freqbins) = tsdft(freqbins);
tsfit = ifft(tsfit);
mu = mean(ts);
tsfit = mu+tsfit;
Second, at the and of tutorial we need to form linear regression model. X matrix which is neccessary for that is formed here like:
X = ones(72,7);
X(:,2) = cos(2*pi/72*(0:71))';
X(:,3) = sin(2*pi/72*(0:71))';
X(:,4) = cos(2*pi*6/72*(0:71))';
X(:,5) = sin(2*pi*6/72*(0:71))';
X(:,6) = cos(2*pi*12/72*(0:71))';
X(:,7) = sin(2*pi*12/72*(0:71))';
I don't understand from where they get numbers 6 and 12 in sin and cos term? This model is opposite of model formed with 3 Fourier frequencies, or 6 Fourier coefficients, but I can't find rule for numbers 6 and 12. Linear model need to have terms cos(2*pi*k*n/N) and sin(2*pi*k*n/N), where n is number of that term, N length of time series, and is k frequency?
댓글 수: 0
답변 (1개)
David Goodmanson
2017년 1월 6일
편집: David Goodmanson
2017년 1월 6일
Hi Jan, You are correct that k is the index corresponding to frequency. In an fft, k = 6 always corresponds to 6 oscillations over the entire time period, whatever the period happens to be. Here the period is 72 months so k corresponds to 6 oscillations in 72 months, i.e. one oscillation per year. Similarly k = 12 corresponds to two oscillations per year, and k = 1 is one oscillation over the entire 72 months. In the tutorial those frequency peaks are the largest so just those are used in the reconstruction. (k=0, the constant term, would have been the largest but it was removed).
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!