bnet2 = mk_bnet(dag, node_sizes);
seed = 0;
rand('state', seed);
%随机初始化网络参数
bnet2CPD{C} = tabular_CPD(bnet2, C);
bnet2CPD{R} = tabular_CPD(bnet2, R);
bnet2CPD{S} = tabular_CPD(bnet2, S);
bnet2CPD{W} = tabular_CPD(bnet2, W);
bnet3 = learn_params(bnet2, samples);
CPT3 = cell(1,N);
for i=1:N
s=struct(bnet3CPD{i}); % violate object privacy
[cory,lag]=xcorr(f,'unbiased');
plot(lag/fs,cory); %自相关函数(无偏差的),其中,f为原函数,cory为要求的自相关函数,lag为自相关函数的长度。fs为地函数的取样频率。
fc=fft(cory);
cm=abs(fc);
fl=(0:length(fc)-1)'fs/length(fc);
plot(fl,cm);%自相关函数的傅里叶变换:即功率谱密度。其中。cm是cory付里叶变换后的幅值。fl为fc的长度。
clear all;
close all;
warning off all;
Fs = 1000;
nfft=1024;
idx = 0:round(nfft/2-1);
k = idxFs/nfft;
t = 0:1/Fs:1;
x1 = rand(1,1001);
[cor1 lag1] = xcorr(x1,'unbiased');
figure(1);
subplot(211),plot(lag1/Fs,cor1),title('(0,1)均匀分布自相关函数');
Xk1 = fft(cor1,nfft);
Px1 = abs(Xk1);
subplot(212),plot(k,10log10(Px1(idx+1))),title('(0,1)均匀分布功率谱密度');
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)