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

📄 experiment3_2.m

📁 Simon Haykin的《Communication Systems》(《通信系统》)的配套MATLAB源代码。包括脉冲调制、随机过程、和差错编码等。
💻 M
字号:
%Experiment 3, CSBOOK-Haykin% adaptive delta modulation for sinwave% Generating sin wavet=[0:2*pi/100:2*pi];       a=10*sin(t);  n=length(a);mindels=1;dels(1:n)=mindels;xhat(1:n)=0;x(1:n)=a;% Adaptive  Delta Modulationd(1:n)=1;for k=2:n 		if ((x(k)-xhat(k-1)) > 0 )    			d(k)=1; 		else d(k)=-1;	end %if	if k==2		xhat(k)=d(k)*mindels+xhat(k-1);	end	if ((xhat(k)-xhat(k-1)) > 0)	    if (d(k-1)  == -1 &d(k) ==1)		xhat(k+1)=xhat(k)+0.5*(xhat(k)-xhat(k-1));	   	    elseif (d(k-1)  == 1 &d(k) ==1)		xhat(k+1)=xhat(k)+1.15*(xhat(k)-xhat(k-1));	    elseif (d(k-1)  == 1 &d(k) ==-1)		xhat(k+1)=xhat(k)-0.5*(xhat(k)-xhat(k-1));	    elseif (d(k-1)  == -1 &d(k) ==-1)  		xhat(k+1)=xhat(k)-1.15*(xhat(k)-xhat(k-1));	    end	else	   if (d(k-1)  == -1 &d(k) ==1)		xhat(k+1)=xhat(k)-0.5*(xhat(k)-xhat(k-1));	  elseif (d(k-1)  == 1 &d(k) ==1)		xhat(k+1)=xhat(k)-1.15*(xhat(k)-xhat(k-1));	  elseif (d(k-1)  == 1 &d(k) ==-1)		xhat(k+1)=xhat(k)+0.5*(xhat(k)-xhat(k-1));	  elseif (d(k-1)  == -1 &d(k) ==-1)	 	xhat(k+1)=xhat(k)+1.15*(xhat(k)-xhat(k-1));          end	endend%Plotsfigure(1);hold on;plot(a);plot(xhat);plot(d-15)

⌨️ 快捷键说明

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