資源簡(jiǎn)介
matlab 檢查數(shù)據(jù)的周期函數(shù).
任給一組離散double 數(shù)據(jù),程序可以自動(dòng)檢查數(shù)據(jù)可能存在的周期并以圖表示。
代碼片段和文件信息
function?T=periodtest(testmat)
%FUNCTION?T=PERIODTEST(TESTMAT)
%TESTMAT?是輸入的單變量數(shù)據(jù),函數(shù)用于統(tǒng)計(jì)數(shù)據(jù)最可能存在的周期
%T返回的是周期,函數(shù)缺省畫出周期圖像
wolfer=testmat;
%year=sunspot(:1);wolfer=sunspot(:2);
%plot(yearwolfer)title(‘Sunspot?Data‘)pause
Y=fft(wolfer);?%Y(1)=[];
n=length(Y);
power=abs(Y(1:n/2)).^2;
nyquist=1/2;
freq=(1:n/2)/(n/2)*nyquist;
figureplot(freqpower)
xlabel(‘data‘);
title(‘periodvalue‘);
period=1./freq;
plot(periodpow
- 上一篇:matlab仿真.rar
- 下一篇:基于matlab的車型識(shí)別源代碼
評(píng)論
共有 條評(píng)論