有GG叫我把我的编程发出来,错了不要怪我

正确与否没有保障

欢迎抛砖

做了的接上

==========================================================
49.Try to give a program to evaluate the DTFT of the following finite-length sequence in the range :
Then run the Program and compute the real and imaginary parts of the DTFT, and the magnitude and phase spectra. Is the DTFT a periodic function of w? If it is, what is the period? Can you explain the jumps in the phase spectrum?
function dtft(N);
y=1.25*ones(1,41);
t=-20:20;
w=-6*pi:12*pi/N:6*pi;
X=zeros(1,N+1);
for n=1:N+1;
k=0;
for j=1:41
k=k+y(j)*exp(-i*w(n)*j);
end
X(n)=k;
end
figure(1);
subplot(2,1,1);stem(t,y);
subplot(2,1,2);plot(w,X);
figure(2);
subplot(2,1,1);plot(real(X));
subplot(2,1,2);plot(imag(X));
figure(3);
plot(unwrap(angle(X)));
059.Design a linear-phase FIR lowpass filter with the following specifications: passband edge at 2.2rad/sec, stopband edge at 4.1 rad/sec, maximum passband attenuation of 0.15dB, minimum stopband attenuation of 42dB, and a sampling frequency of 20rad/sec. Using the function fir1 and window of Kaiser to design. Show the impulse response coefficients and plot the gain response of the designed filter. Comment on your result.
fedge=[2.2/pi/2,4.1/pi/2];
mval=[1,0];
dev=[1-10^(-0.15/20),1-10^(-42/20)];
ft=20/2/pi;
[n,wn,beta,type]=kaiserord(fedge,mval,dev,ft);
b=fir1(n,wn,type,kaiser(n+1,beta),'noscale');
[h,w]=freqz(b,1,256);
plot(w/pi,20*log(abs(h)));
grid;
xlabel('\omega/\pi');ylabel('gain,db');
[ 此帖被阿董在2008-01-14 19:38重新编辑 ]