length-64). x(t)?sin(0.1?t)?2cos(0.3?t)?3sin(0.5?t)ft=20000; n=1:64;
x=sin(0.1*pi*n/ft)+2*cos(0.3*pi*5*n/ft)+3*sin(0.5*pi*n/ft); subplot(2,1,1);
[h,w]=freqz(x,1,256); plot(w/pi,abs(h));
title('Magnitude spectrum of the sampled samples'); xlabel('\\omega/\\pi'); ylabel('Magnitude'); subplot(2,1,2);
plot(w/pi,angle(h));
title('Phase spectrum of the sampled samples'); xlabel('\\omega/\\pi'); ylabel('Phase');
(15)Write a MATLAB program to compute the first L samples of the inverse of rational z-transforms where the value of L is provided by the user through the command input. Using this program to compute and plot the first 50 samples of the inverse of following G(z). Use the command stem for plotting the sequence generated by the inverse transform
108 G3(z)??2?4?z?1?2?z?1,|z|?0.5L=input('input the L='); r=[10/4 -8/2]; p=[-1/4 -1/2]; k=-2;
[B,A]=residuez(r,p,k) [h t]=impz(B,A,L) stem(t,h);
Writing a MATLAB program to compute the circular convolution of two length-N sequences via the DFT-based approach. Using this program to determine the following pair of sequences:
g[n]={7, 4, -9, 0, 2, -5}, h[n]={1, -1, 2, 0, 10, 5} or And plot the result sequence x1=[7 4 -9 0 2 -5]; x2=[1 -1 2 0 10 5]; L=length(x1); y=zeros(1,L);
x2tr = [x2(1) x2(L:-1:2)]; for k = 1:L,
sh = circshift(x2tr', k-1)'; h = x1.*sh; y(k) = sum(h); end
disp(y);
n=0:length(x1)-1; stem(n,y);
n=0:50;
x=sin(5*pi*n/16);
stem(n,x); %或者如下 syms n1; %x1=x’ x1=sin(5*pi*n1/16).^2; y=symsum(x1,n1,0,50) y1=double(y)
%y=x*x1