📄 delay.m
字号:
clear
fs=8000;
f=2500;
t=0:1/fs:1023/fs;
x=sin(2*pi*f*t);
y=sin(2*pi*f*t+pi/3);
X=fft(x,1024);
Y=fft(y,1024);
psd=csd(x,y);
d=atan(imag(max(psd))/real(max(psd)));
d=d*180/pi;
subplot(2,3,1),plot(x);
subplot(2,3,4),plot(abs(X),'r');
subplot(2,3,2),plot(y);
subplot(2,3,5),plot(abs(Y),'g');
subplot(2,3,3),plot(abs(psd));
subplot(2,3,6),plot(d,'x')
cell_string{1}='\fontsize{14}\fontname{隶书}相位差';
cell_string{2}=['\fontsize{14}\rmd = ' num2str(d)];
cell_string{3}='\fontsize{10}\downarrow';
text(0.97,d+0.5,cell_string)
%text(1,d+1,'{相位差}=60')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -