赞
踩
时间序列的matlab功率谱分析函数
function spectrum()
%spectrum()
%%load data and some parameters.
inputfile=input('Please input the data file name:','s');
fidin=fopen(inputfile,'r');
helpin=strcat('Can''t open the file---',inputfile);
if fidin==-1
error(helpin);
end
x=fscanf(fidin,'%f');
fclose(fidin);
N=length(x);
M=input('Please input the M value:');
alpha=input('Please input the confidence interval(in decimal):');
%Calculating auto_connection coefficient.
aver_x=sum(x)./N;
fangcha_x=sum((x-aver_x).^2)./N;
for c1=0:M
CC(c1+1)=0;
for c2=1:(N-c1)
CC(c1+1)=CC(c1+1)+(x(c2)-aver_x).*(x(c2+c1)-aver_x)./fangcha_x;
end
CC(c1&#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。