?? chongjixiangying.m
字號:
zizhenyuan_shu=101;fs=40000;
Data_path='D:\bsdata\shuiping\80zheng\1.';
i=96;
data_i=rename(i);
filename=strcat(Data_path,data_i);
[hp,hvx,hvy]=xindao2(filename,fs);
hp1=hp;
length0=size(hp1,2);
for n1=1:length0;
if hp1(1,n1)~=0,break,end
end
length1=4000-(length0-n1+1);
if length1>0;
hp1=[hp1,zeros(1,length1)];
end %n1后的數不足3999個,就補零
hp1=hp1(:,[n1:(n1+3999)]);
% hp1=hp1(:,[n1:length1]);
figure(1);
subplot(211)
plot((0:3999)*1000/fs,hp1);
xlabel('time(ms)')
ylabel('幅度')
fft_p1=fft(hp1);
subplot(212);
plot((0:length(fft_p1)-1)/length(fft_p1)*fs,abs(fft_p1));
xlabel('f/Hz');
ylabel('|H(f)|');
Data_path='D:\bsdata\shuiping\psbianhua\58.'
for j=1;
data_j=rename(j);
filename=strcat(Data_path,data_j);
[hp,hvx,hvy]=xindao2(filename,fs);
hp2=hp;
length2=size(hp2,2);
for n2=1:length2;
if hp2(1,n2)~=0,break,end;
end
length3=4000-(length2-n2+1);
if length3>0;
hp2=[hp2,zeros(1,length3)];
end %n1后的數不足3999個,就補零
hp2=hp2(:,[n2:(n2+3999)]);
% hp2=hp2(:,[n2:length2]);
figure(2);
subplot(211)
plot(hp2);
%信道二圖
fft_p2=fft(hp2);
subplot(212);
plot((0:length(fft_p2)-1)/length(fft_p2)*fs,abs(fft_p2));
xlabel('f/Hz');
ylabel('|H(f)|');
end
% figure(3)
% plot(abs(xcorr(hp1,hp2,'coeff')));
% if size(hp2,2)>size(hp1,2);
% M=size(hp2,2)-size(hp1,2);
% b(j)=max(abs(xcorr([hp1,zeros(1,M)],hp2,'coeff')));
% figure(3)
% plot(abs(xcorr([hp1 ,zeros(1,M)],hp2,'coeff')));
% else size(hp2,2)<size(hp1,2);
% M=size(hp1,2)-size(hp2,2);
% b(j)=max(abs(xcorr(hp1,[hp2,zeros(1,M)],'coeff')));
% figure(3);
% plot(abs(xcorr(hp1,[hp2,zeros(1,M)],'coeff')));
% end
% end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -