Digital Signal Processing Reference
In-Depth Information
%subplot(222) ;plot(xnew) ;title('B') ;grid;
pause;
%print -depsc f6_2
subplot(221);plot(fx,sxnew,'.-');grid;title('A');xlabel(' Freq ');
[smax,i]=max(sxnew);s=4;e=7;
y1=sxnew(i-s:i+e);f1=fx(i-s:i+e);
f2=linspace(f1(1),f1(length(f1)),100);
p=polyfit(f1,y1,3) ;y1hat=polyval(p,f2);
subplot(222);
stem(f1,y1);grid
hold;
%plot(f1,y1,'.-',f2,y1hat);grid;title('B')
plot(f2,y1hat,'.');grid;title('B');
grid;xlabel(' Freq ');
pause;
%print -depsc f6_2a
A.4.5 Program f 4_61_5b
%Digital Signal Processing:A Practitioner's Approach
%Dr.Kaluri Venkata Ranga Rao, kaluri@ieee.org
%Generates figure 4.3
clear;close;clf;
range=12;
F_u=linspace(0.01,0.22,range);
for k=1:range
tiks=150; f_smp=200; f_u=F_u(k);
x=1:tiks; x=x*0;
x(tiks)=1;
for i=1:f_smp
s=1+(i-1)*tiks; e=s+tiks-1;
u(s:e)=x;
end
b=1;a=[1 -1];
z=filter(b,a,u); nz=length(z); z(nz)=z(nz-1);
z=(z/max(z))*0.5;
%z=(z/max(z))*0.25;
t=1:nz;
% Frequency Sweep
xk=cos(2*pi*z.*t);
% Unknown signal
zk=sin(2*pi*f_u*t)+1*randn( [1 nz]);
Search WWH ::




Custom Search