⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showcorr_sine.m

📁 biomedical stuffs...
💻 M
字号:
%	showcorr_sine.m
%	This program is distributed as a supplement to the book
%	"Biomedical Signal Processing and Signal Modeling" by E. N. Bruce,
%	published by Wiley, 2000.  It is provided for educational use only.
%  While every effort has been made to insure its suitability to illustrate
%  principles described in the above book, no specific feature or capability 
%  is implied or guaranteed.
dt=1;
t=[-900:dt:900]'/100;r1=1; r2=2*fix(900/dt)+1;npts=500;
%x=stepfun(t,0)-stepfun(t,3);
x=[zeros(900,1);sin(2*pi*t(901:1000));zeros(801,1)];
subplot(311), plot(t(r1:r2),x(r1:r2),'k'), ylabel('x(t)')
corrfn=zeros(size(t));lagmax=r2;
for t0 = 0:dt:r2-1
   leftover=fix(r2/2)+1-npts+t0;
   %  y=[zeros(fix(r2/2)-t0,1);x(t0+fix(r2/2)+1:t0+fix(r2/2)+npts+t0);zeros(leftover,1)];
   y=[zeros(fix(r2/2)-t0,1);x(fix(r2/2)+1:r2);zeros(t0,1)];
   subplot(312),plot(t(r1:r2),y,'r'), ylabel('x(t+s)')
   value=sum(x.*y)/r2;
   corrfn(fix(r2/2)+1+t0)=value;hlim=fix(r2/2)+1+t0;axlim=10;
   subplot(313), plot(t(t>=0),corrfn(t>=0),'r'),axis([-axlim,axlim,-2*max(corrfn),2*max(corrfn)]), ylabel('Rx(s)')
   pause(0.1)
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -